comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Producing potable color images from IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Producing potable color images from IDL? [message #32971] Sun, 24 November 2002 14:17
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris Mulliss (cmulliss@columbus.rr.com) writes:

> This is not strictly an IDL question, but here goes...
>
> When I produce 24-bit color images in IDL (running on a SUN) and try to
> display them on an SGI or Windows box, they tend to come out looking very
> dark.
>
> I have been told that it is probably a hardware-dependent gamma correction
> problem. I have been told also that the PNG image format has the ability to
> store the gamma value of the machine that the image was created so that the
> image can be "gamma corrected" on other platforms. IDL's help on PNG does
> not mention this feature and I have this problem with all file formats that
> I have tried including PNG.

I don't know anything about PNG storing the gamma correction,
but it doesn't appear IDL supports that feature, even if true.

> So, does anybody know what is going on? Has anyone found a way to make
> images in IDL that don't look dark on other platforms? Does anyone have a
> reference to the mathematical nature of this "gamma correction" so that I
> look into accounting for it in code.

The "gamma" correction is just the image value multiplied by
a constant and raised to some power. The "raised to the power"
part is called the "gamma". Gammas less than one (e.g. 0.25,
0.4, 0.76) will lighten an image and gammas greater than
one (e.g., 1.5, 2.75, 10) will darken it. Try something like
this:

filename = Findfile(Subdir='examples','data'], 'ctscan.dat')
image = BytArr(256, 256)
Openr, lun, filename, /Get_Lun
ReadU, lun, image
Free_lun, lun

LoadCT, 0
Window, XSize=512, YSize=256
TV, image
TV, BytScl(3 * image ^ 0.75), 1

In practice, you probably have to fool around with the
constant (3, in this case) and the gamma (0.75, in this
case), until you find something that works for your
monitors. Then, just multiply by this gamma "correction
factor" before you save your images.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: colorbar range & rounded values
Next Topic: sec : U Re: Producing potable color images from IDL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 10:13:05 PDT 2025

Total time taken to generate the page: 1.51565 seconds