Re: Colored image [message #41059] |
Thu, 23 September 2004 08:52  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning wrote:
> If you are talking about talking a 2D 8-bit image...
Say what!? Having a few language difficulties here. :-(
But you Linux guys will be glad to know I've got my
IDLWAVE Emacs mode working! Wow. I feel like a scientist
already. :-)
Cheers,
David
P.S. Those of you who sent me consoling e-mails after my
last journal entry should know that things are MUCH better
now, and I will be back to being myself again in my next
post (later tonight, hopefully).
|
|
|
Re: Colored image [message #41060 is a reply to message #41059] |
Thu, 23 September 2004 08:45   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Julio writes:
> I'm using the following code to generate a JPEG of an image. The
> figure is generated in black and white format. Does anybody know how
> can I generate a colored image?? (e.g. using a color table).
>
> Thanks!
>
> image=[(ndvi)]
> ndvi_jpg='ndvi.jpg'
> ndvi = HIST_EQUAL(ndvi, percent=2)
> WRITE_JPEG, ndvi_jpg, ndvi, QUALITY=100, order=1
If you are talking about talking a 2D 8-bit image,
and saving it as a 24-bit color JPEG image, you might
do something like this:
Loadct, 5 ; Load a color table
TVLCT, r, g, b, /Get ; Get the color table vectors
s = Size(image2d, /Dimensions) ; Size of 2D image
image24 = BytArr(3, s[0], s[1]) ; Create 24-bit image.
image24[0,*,*] = r[image2d] ; Create color lookup planes.
image24[1,*,*] = g[image2d]
image24[2,*,*] = b[image2d]
Write_JPEG, 'myimage.jpg, image24, True=1, Quality=100
If you want the order to be reversed, I wouldn't use the ORDER
keyword, which I find completely unreliable, rather, I would
reverse the Y data:
Write_JPEG, 'myimage.jpg, Reverse(image24,3), True=1, Quality=100
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
|
|
|
Re: Colored image [message #41188 is a reply to message #41059] |
Fri, 24 September 2004 13:19  |
julio
Messages: 31 Registered: December 2003
|
Member |
|
|
Hello David,
Your tip worked out perfectly...
Thanks!
Cheers,
Julio
David Fanning <guest04@eso.org> wrote in message news:<ciurfp$523$1@nntp.hq.eso.org>...
> David Fanning wrote:
>
>> If you are talking about talking a 2D 8-bit image...
>
> Say what!? Having a few language difficulties here. :-(
>
> But you Linux guys will be glad to know I've got my
> IDLWAVE Emacs mode working! Wow. I feel like a scientist
> already. :-)
>
> Cheers,
>
> David
>
> P.S. Those of you who sent me consoling e-mails after my
> last journal entry should know that things are MUCH better
> now, and I will be back to being myself again in my next
> post (later tonight, hopefully).
|
|
|