RE: Fade between two images (dissolve)




Hi,I'm wanting to load two images and fade between them much like
the ImageMagick command:
composite --dissolve 100 image1.jpg image2.jpg output.jpg
However I'm wanting to display the image as it dissolves from one
image to the other - so it will apear as if one image is dissolving
into another in realtime.  Can this be done with something like
gdk_pixbuf_composite??

Yes.  With limitations.

GTK doesn't care much for advanced image manipulation, as has been stated (rather ungracefully).  It's more 
interested in advanced GUI construction without requiering an advanced masters degree.  But it does have 
facilities for some basic image manipulation (scaling, compositing, stuff like that) kicking around in 
gdk-pixbuf.

Now, since GTK isn't an imaging toolkit, it's not going to be super-fast at it, or have any of those trippy 
filters and stuff.  So if you want a nice fast fade, you'll probably need something else to get at the memory 
flipping and parallel pixel manipulation techniques.  But there's a good chance you'll be able to do what you 
want with what's already there.

I'm not an expert, but my suggestion would be this; load your two images into gdk-pixbufs, and turn one of 
them into a GtkImage to go in the window.  You then use an idler to progressively mix the second image into 
the first, then telling the GtkImage to update itself.  This should take precedence over the idler giving you 
a fade and a reasonable sense of what kind of speeds you can expect out of straight GTK.

You'd probably want to play with it a bit; for a more precise fade, you'll probably need to work on a copy of 
the first image.  But that's an extra image copy, and I think the GtkImage takes a copy itself when you tell 
it to update.  Using ImageMagick directly, and those other non-GTK techniques, can probably avoid a lot of 
that.  But GTK-only is probably a fair enough place to start.


Fredderic

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]