Re: How to convert a jpg image to a GtkImage ?
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: How to convert a jpg image to a GtkImage ?
- Date: Fri, 31 Aug 2007 23:18:42 +0200
On Fri, Aug 31, 2007 at 02:11:15PM -0700, Mike Melanson wrote:
I have an application, that amoung other things, is receiving a jpg file
from a network connection. Once that file is in memory (it's relatively
small), I wish to load it into a GtkImage (so that I can display it,
e.g. by adding the GtkImage to a vbox, or something like that).
...
My first impulse is that you will need to drag libjpeg into this (pretty
standard everywhere) and delegate image decoding over to that module.
Then create a new image in memory with gdk_image_new() and copy the
decoded RGB data over.
No, explicit use of libjpeg is not necessary. Create a
GdkPixbufLoader, feed the in-memory image date to it with
gdk_pixbuf_loader_write() and if everything is all right
fetch the GdkPixbuf from it. Then construct the GtkImage
with gtk_image_new_from_pixbuf().
Yeti
--
http://gwyddion.net/
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]