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

Home » Public Forums » archive » Re: color problem when capture the object window
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: color problem when capture the object window [message #38560] Mon, 15 March 2004 09:00
lius02 is currently offline  lius02
Messages: 6
Registered: November 2003
Junior Member
David Fanning <david@dfanning.com> wrote in message news:<MPG.1abb9f5a579700e29896ff@news.frii.com>...
> Songtao Liu writes:
>
>> I write the captured screen images to a bmp file and when I look at
>> the bmp file, I found the color is not what it looks like on the
>> screen.
>>
>> It is just a simple widget program, with several object graphic
>> windows, each display an image and ROIs(draw with plot object).
>>
>> Followings are the codes to capture the screen display and write them
>> to the disk
>>
>> ;capture the window display
>> draw_id -> getProperty, image_data = data
>> ;write to file
>> write_bmp, filename, data
>
> Oh, right. For some reason, when you create 24-bit color BMP
> files, Microsoft wants them in the form of BGR rather than RGB.
> (Don't ask me, I don't have the foggiest idea.)
>
> So just flip your red and blue image planes and you will
> be good to go. I typically avoid this problem by writing
> 8-bit BMP files with color tables. See my XImage program,
> for example.
>
> Cheers,
>
> David

Dear Dr. Fanning,

Thank you very much for your instruction. After reading your Ximage
program, I figured out that I missed the line:

image2D = color_quan(snapshot, 1, r, g, b)

now the captured picture is exactly the same as they are shown on the
screen.

Thanks again and have a terrrrrific nice day!

Songtao
Re: color problem when capture the object window [message #38592 is a reply to message #38560] Fri, 12 March 2004 09:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Songtao Liu writes:

> I write the captured screen images to a bmp file and when I look at
> the bmp file, I found the color is not what it looks like on the
> screen.
>
> It is just a simple widget program, with several object graphic
> windows, each display an image and ROIs(draw with plot object).
>
> Followings are the codes to capture the screen display and write them
> to the disk
>
> ;capture the window display
> draw_id -> getProperty, image_data = data
> ;write to file
> write_bmp, filename, data

Oh, right. For some reason, when you create 24-bit color BMP
files, Microsoft wants them in the form of BGR rather than RGB.
(Don't ask me, I don't have the foggiest idea.)

So just flip your red and blue image planes and you will
be good to go. I typically avoid this problem by writing
8-bit BMP files with color tables. See my XImage program,
for example.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: color problem when capture the object window [message #38596 is a reply to message #38592] Fri, 12 March 2004 08:44 Go to previous message
lius02 is currently offline  lius02
Messages: 6
Registered: November 2003
Junior Member
David Fanning <david@dfanning.com> wrote in message news:<MPG.1aba98dee23ffa009896fb@news.frii.com>...
> Songtao Liu writes:
>
>> I meet a color problem when capture the images of object window. I
>> have a small program with 5 object windows and I use following codes
>> to change the color table and capture the display in the window
>>
>> ;call xloadct
>> xloadct, /modal, group = event.top
>>
>> ;get the changed color table
>> tvlct, R, G, B, /get
>>
>> ;change the palette object
>> opalette ->setProperty, red_values = R, green_values = g, blue_values
>> = b
>>
>> ;capture the window display
>> draw_id -> getProperty, image_data = data
>>
>>
>> If using BW color table, the captured screen image is correct,
>> otherwise, the color of the captured screen image is not correct.
>
> What makes you think the color of the captured
> screen image is not correct? What are you doing
> with the image? A little code, if you please. :-)
>
> Cheers,
>
> David


Dear Dr. Fanning,

I write the captured screen images to a bmp file and when I look at
the bmp file, I found the color is not what it looks like on the
screen.

It is just a simple widget program, with several object graphic
windows, each display an image and ROIs(draw with plot object).

Followings are the codes to capture the screen display and write them
to the disk

;capture the window display
draw_id -> getProperty, image_data = data
;write to file
write_bmp, filename, data

Thank,

Songtao
Re: color problem when capture the object window [message #38611 is a reply to message #38596] Thu, 11 March 2004 14:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Songtao Liu writes:

> I meet a color problem when capture the images of object window. I
> have a small program with 5 object windows and I use following codes
> to change the color table and capture the display in the window
>
> ;call xloadct
> xloadct, /modal, group = event.top
>
> ;get the changed color table
> tvlct, R, G, B, /get
>
> ;change the palette object
> opalette ->setProperty, red_values = R, green_values = g, blue_values
> = b
>
> ;capture the window display
> draw_id -> getProperty, image_data = data
>
>
> If using BW color table, the captured screen image is correct,
> otherwise, the color of the captured screen image is not correct.

What makes you think the color of the captured
screen image is not correct? What are you doing
with the image? A little code, if you please. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Announcing GDL 0.7, now with PLOT command
Next Topic: Poisson eq solver?

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

Current Time: Sat Oct 11 12:29:28 PDT 2025

Total time taken to generate the page: 0.48604 seconds