Forum: Ruby-Gnome 2 load Gdk::Pixbuf from string

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mathieu B. (Guest)
on 2009-01-08 06:05
(Received via mailing list)
Hi all,

I have a Ruby string containing an image. The format, width, height,
per sample, rowstride and so on, are not known in advance.

If I save my string to a file and create a pixbuf with, this works, but I would like to get my pixbuf
without touching the hard disk. Is that possible?

Any help appreciated.

Thank you,
Mathieu B.
Dobai-Pataky B. (Guest)
on 2009-01-08 11:12
(Received via mailing list)
this is how i did it:
Geoff Y. (Guest)
on 2009-01-08 12:34
(Received via mailing list)
If it's an encoded image (e.g. JPEG, PNG etc) rather than a serialized
GdkPixdata, you'll want to use Gdk::PixbufLoader

loader =

pixbuf = loader.pixbuf

2009/1/8 Dobai-Pataky B. <removed_email_address@domain.invalid>
Mathieu B. (Guest)
on 2009-01-08 14:41
(Received via mailing list)
Thank you to both of you for your quick reply. Yes, my string contains
dump of an encoded file. It's not a string of pixels. The PixbufLoader
solution made the trick! I should not work when I'm too tired, this
makes me
misread the documentation ;-)

2009/1/8 Geoff Y. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.