How to get the image in drawing area as a BMP file ?


Hi All,

         For my application i need to get the picture drawn in the drawing area widget as a file.I have written the following code , but it doesnt work ...... (i.e) the function ->

                    gdk_pixbuf_save() ..... i can get as a JPEG file but i tried several times to get a BMP file & could not get it.

                     Is there any thing with the GTK version im using, which is Gtk-2.2.1. Please tell me some idea behind this which will work.

--------------------------The sample code im using--------------------------------------------------------

colormap = gtk_widget_get_colormap(drawing_area);


pixbuf = gdk_pixbuf_get_from_drawable(NULL,GDK_DRAWABLE(drawing_area->window),colormap,drawing_area->allocation.x, drawing_area->allocation.y, 0, 0,drawing_area->allocation.width, drawing_area->allocation.height );

gdk_pixbuf_save (pixbuf, "/root/handle.bmp", "bmp",NULL, NULL, NULL); // to save as jpeg works



                                       Thanks in advance.



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