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

Home » Public Forums » archive » Re: Write_bmp procedure changes RGB color order to BGR for input image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Write_bmp procedure changes RGB color order to BGR for input image [message #22573 is a reply to message #22569] Tue, 14 November 2000 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
sandeep.dalal@philips.com (Sandeep Dalal) writes:
...
>
> To my surprise, I discovered that using the RGB keyword in the IDL
> procedure "write_bmp" actually changes the color order of the supplied
> input image from RGB to BGR color order. This is non-intuitive. I
> would have expected that the keyword was only to indicate that the
> array is being supplied in the standard RGB color order. When IDL
> writes the file with the RGB keyword set, it should swap the red and
> blue buffers of the original image being written to the BMP file, but
> not swap them in the original image.
>
> For e.g.
> IDL> img = read_image(some_true_color_image_file) ; in RGB color order
> IDL> tv, img, /true ; looks good
> IDL> write_bmp, filename.bmp, img, /rgb
> IDL> tv, img, /true ; no good (:-(!

This is a classic error in IDL programming: a procedure modifying
parameters that it shouldn't. A smart procedure takes great care not
to modify its arguments.

The disappointment is that this lame code comes from RSI.

By the way this doesn't appear in IDL 5.0 or 5.2, so it's a new
addition.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: SLOW finite() on PV-WAVE under NT--old?
Next Topic: IDL Programming Techniques, 1st edition on ebay

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

Current Time: Fri Oct 10 11:29:50 PDT 2025

Total time taken to generate the page: 0.95904 seconds