How do I remove (or apply) transparency on a gdk-pixbuf?
Posted
by Andrew Stacey
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Stacey
Published on 2010-04-30T11:21:46Z
Indexed on
2010/04/30
11:27 UTC
Read the original article
Hit count: 355
I have a c++ program in which a gdk-pixbuf is created. I want to output it as an image, so I call gdk_pixbuf_save_to_stream(pixbuf,stream,type,NULL,&err,NULL)
. This works fine when "type" is png or tiff, but with jpeg or bmp it just produces a black square. The original pixbuf consists of black-on-transparent (and gdk_pixbuf_get_has_alpha
returns true) so I'm guessing that the problem is with the alpha mask.
GdkPixbuf has a function to add an alpha channel, but I can't see one that removes it again, or (which might be as good) to invert it.
Is there a simple way to get the jpeg and bmp formats to work properly?
(I should say that I'm very new to proper programming like this.)
© Stack Overflow or respective owner