Main Page | Report Page

 

  Computers Forum Index » Computer Languages (IDL-PVWAVE) » overlaying a transparent 24-bit image with different...

Author Message
Jeremy Bailin...
Posted: Fri Oct 29, 2010 5:53 pm
 
I'm sure this task is trivial with the right tools. But apparently I
am missing them.

I have an 8-bit image that I am generating in my code, which I display
using a colour table with TVIM, using it to draw axes and set the
data coordinates.

I then want to overplot a 24-bit image with an alpha channel,
centering it at a specific *data* coordinate, and using a known pixel
scale in data coordinates (which is quite different from 1).

I can calculate the appropriate normalized coordinates corresponding
to the corners of where the image should be placed. I've tried feeding
that and the 24-bit image into TVIMAGE, but it uses a white background
for the alpha channel, not what already exists on the display. And
David's example for overlaying things (http://www.dfanning.com/ip_tips/
transparentpng.html) assumes a relative pixel scale of 1.

I'm sure I can figure out how to roll my own version of this myself,
but I'm also sure it would take a lot longer than finding a tool
someone's already written. Smile=

-Jeremy.
 
Jeremy Bailin...
Posted: Fri Oct 29, 2010 6:44 pm
 
On Oct 29, 2:36 pm, David Fanning <n... at (no spam) dfanning.com> wrote:
Quote:
Jeremy Bailin writes:
I can calculate the appropriate normalized coordinates corresponding
to the corners of where the image should be placed. I've tried feeding
that and the 24-bit image into TVIMAGE, but it uses a white background
for the alpha channel, not what already exists on the display. And
David's example for overlaying things (http://www.dfanning.com/ip_tips/
transparentpng.html) assumes a relative pixel scale of 1.

Well, a new keyword will probably fix that up! :-)

I was going to make a change to TVImage today anyway,
so I might as well do this at the same time. My only
concern is that if I take what's in the display window
as the background for the alpha channel, this will NOT
make it possible to display the image in PostScript.
(No window to read from.) Is this a limitation you
can live with?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming:http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Unfortunately, that's kind of essential. Sad So I think rolling my
own is going to be necessary anyway... though it would certainly be a
good thing to have in TVIMAGE, even I can't use it today!

Since the background is something that I generate myself, I can fake
the output of TVRD by putting the 8-bit image through the colour
table. I should be okay as long as I can keep track of all the
different coordinates in several different coordinate systems on a
Friday afternoon. ;-)

-Jeremy.
 
Jeremy Bailin...
Posted: Fri Oct 29, 2010 6:47 pm
 
On Oct 29, 2:41 pm, David Fanning <n... at (no spam) dfanning.com> wrote:
Quote:
David Fanning writes:
My only
concern is that if I take what's in the display window
as the background for the alpha channel, this will NOT
make it possible to display the image in PostScript.
(No window to read from.) Is this a limitation you
can live with?

Maybe I would have to make you supply a "background"
image, from which I could take the information I
need to do the alpha blending. This would work, I think,
on all devices.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming:http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Yes, that would work for me! I think having the option of reading it
straight from the display, when available, would also be great.

-Jeremy.
 
Jeremy Bailin...
Posted: Fri Oct 29, 2010 8:13 pm
 
On Oct 29, 3:24 pm, David Fanning <n... at (no spam) dfanning.com> wrote:
Quote:
Jeremy Bailin writes:
Yes, that would work for me! I think having the option of reading it
straight from the display, when available, would also be great.

Humm. This is a little more complicated than I expected it to
be. The code is not structured with this in mind, and I am
reluctant to undergo big structural changes to such an
important program. It might be possible, but I want to move
slowly.

I should think, though, that you might be able to work
some kind of solution out with BlendImage.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming:http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Yup, I've got it working. Now, if only it showed the result I'd
hoped! ;-)

-Jeremy.
 
David Fanning...
Posted: Fri Oct 29, 2010 10:36 pm
 
Jeremy Bailin writes:

Quote:
I can calculate the appropriate normalized coordinates corresponding
to the corners of where the image should be placed. I've tried feeding
that and the 24-bit image into TVIMAGE, but it uses a white background
for the alpha channel, not what already exists on the display. And
David's example for overlaying things (http://www.dfanning.com/ip_tips/
transparentpng.html) assumes a relative pixel scale of 1.

Well, a new keyword will probably fix that up! :-)

I was going to make a change to TVImage today anyway,
so I might as well do this at the same time. My only
concern is that if I take what's in the display window
as the background for the alpha channel, this will NOT
make it possible to display the image in PostScript.
(No window to read from.) Is this a limitation you
can live with?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
 
David Fanning...
Posted: Fri Oct 29, 2010 10:41 pm
 
David Fanning writes:

Quote:
My only
concern is that if I take what's in the display window
as the background for the alpha channel, this will NOT
make it possible to display the image in PostScript.
(No window to read from.) Is this a limitation you
can live with?

Maybe I would have to make you supply a "background"
image, from which I could take the information I
need to do the alpha blending. This would work, I think,
on all devices.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
 
David Fanning...
Posted: Fri Oct 29, 2010 11:24 pm
 
Jeremy Bailin writes:

Quote:
Yes, that would work for me! I think having the option of reading it
straight from the display, when available, would also be great.

Humm. This is a little more complicated than I expected it to
be. The code is not structured with this in mind, and I am
reluctant to undergo big structural changes to such an
important program. It might be possible, but I want to move
slowly.

I should think, though, that you might be able to work
some kind of solution out with BlendImage.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
 
David Fanning...
Posted: Sat Oct 30, 2010 12:35 am
 
Jeremy Bailin writes:

Quote:
Yup, I've got it working. Now, if only it showed the result I'd
hoped! Wink

Yes. Always a problem. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
 
 
Page 1 of 1    
All times are GMT
The time now is Tue Sep 02, 2014 4:43 am