Displaying Transparent Images [message #73365] |
Fri, 05 November 2010 08:44  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
Jeremy's suggestion the other day about displaying alpha channel
images with TVImage was a good one. It has taken me a week or so
to get all the bugs worked out (lots of code changes!), but I think
I am finally there. I've put up a new version this morning with
another bug fix and some code rearrangement to make the code
easier to maintain. (Amazing how much things can be improved
after you understand what you are doing!)
http://www.dfanning.com/programs/tvimage.pro
Testing this functionality gave me a lot of good ideas for
how it can be used. In fact, I found I *really* had a need
for displaying transparent images yesterday! A transparent
image is one in which a particular color has been knocked
out so you can see the background behind it.
To make this easy to do, I wrote a new program, named
Make_Transparent_Image, last night to create transparent
images either from other images I have laying around
or directly from graphics windows containing plots and
such that I wish to display on other, background images.
(I was fooling around making image mash-ups for book
cover designs.) You can find the program here:
http://www.dfanning.com/programs/make_transparent_image.pro
I have to admit, it's pretty neat. I'm displaying plots
and such with white backgrounds. If I want to create
an image with the white background knocked out, so I
can put the plot on another image, I just do something
like this:
IDL> Histoplot, LoadData(7)
IDL> transparent = Make_Transparent_Image(Color='white')
IDL> LoadCT, 22
IDL> TVImage, Loaddata(7)
IDL> TVImage, transparent, POSITION=[0.5, 0.5, 0.95, 0.95]
Totally cool! :-)
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.")
|
|
|