PGdkPixbuf to byte array lazarus / 39-Graphics ---------------------------------------------------------------------- mrdebug · 2010-05-28 02:34 How can I save a PGdkPixbuf object into a byte array using fpc? These functions: Code: [Select]gdk_pixbuf_save_to_buffer gdk_pixbuf_save_to_bufferv gdk_pixbuf_save_to_callback gdk_pixbuf_save_to_callbackvthere aren't in fpc. ---------------------------------------------------------------------- Marc · 2010-05-28 03:40 have a look at gdk_pixbuf_get_pixels (and you may also need gdk_pixbuf_get_rowstride) Or do you need more than pixels ? ---------------------------------------------------------------------- mrdebug · 2010-05-28 05:12 I need a way to obtain an array to send at a client. ---------------------------------------------------------------------- Marc · 2010-05-30 16:24 What is the difference between a pointer to a bunch of pixels and an array of pixels ? ---------------------------------------------------------------------- mrdebug · 2010-05-31 00:31 When you execute the function to obtain the array of pixels you can select the format of the image in the array (I need jpeg compression.). I have extended the gtk2pixbas.pas unit with this code: Code: [Select]type AByteIn= array of byte; type PAByteIn= ^AByteIn; type TGdkPixbufSaveFunc= function(buffer:PChar; count:gsize; error:PPGError; AAByteIn:PAByteIn): gboolean; cdecl; function gdk_pixbuf_save_to_callback(pixbuf:PGdkPixbuf; save_func:TGdkPixbufSaveFunc; data:gpointer; _type:Pchar; error:PPGError): gboolean; cdecl; external gdkpixbuflib; The code works well but obtain an jpeg image requires some seconds. With RGBGraphics libraries obtain a jpeg image requires 150 milliseconds. Do you now a faster way?