Hi, I'm testing out stuff in my JournalMorph but run into stuff I can't figure out.
I'm trying to view a png preview stored in a ByteArray but I don't get it to work. I make the ByteArray a RWBinaryOrTextStream but the PNGReadWriter formFromStream: aStream do not recognize the format.
I'm not sure how to proceed.
I also tried to write out a png to the Journal but that would not work either :-(
Karl
Here is the Python/GTK way to do this, for what it is worth:
from sugar.datastore import datastore ... #my_dsobject is of type datastore.DSObject #object_id is a datastore object my_dsobject = datastore.get(object_id)
pixbufloader = gtk.gdk.pixbuf_loader_new_with_mime_type('image/png') #Access the 'preview' property #Note that the preview image is 300x225 pixbufloader.write(dsobject.metadata['preview']) pixbufloader.close() pixbuf = pixbufloader.get_pixbuf()
-walter
On Sat, Jan 17, 2009 at 9:40 AM, Karl Ramberg karlramberg@gmail.com wrote:
Hi, I'm testing out stuff in my JournalMorph but run into stuff I can't figure out.
I'm trying to view a png preview stored in a ByteArray but I don't get it to work. I make the ByteArray a RWBinaryOrTextStream but the PNGReadWriter formFromStream: aStream do not recognize the format.
I'm not sure how to proceed.
I also tried to write out a png to the Journal but that would not work either :-(
Karl
Etoys mailing list Etoys@lists.laptop.org http://lists.laptop.org/listinfo/etoys
Walter Bender wrote:
Here is the Python/GTK way to do this, for what it is worth:
from sugar.datastore import datastore ... #my_dsobject is of type datastore.DSObject #object_id is a datastore object my_dsobject = datastore.get(object_id)
pixbufloader = gtk.gdk.pixbuf_loader_new_with_mime_type('image/png') #Access the 'preview' property #Note that the preview image is 300x225 pixbufloader.write(dsobject.metadata['preview']) pixbufloader.close() pixbuf = pixbufloader.get_pixbuf()
-walter
Thanks. I got it working my self but there are quite a few of the previews that don't seem to work, and most criticaly photos from Record I can't get to work.
Karl
On Sat, Jan 17, 2009 at 9:40 AM, Karl Ramberg karlramberg@gmail.com wrote:
Hi, I'm testing out stuff in my JournalMorph but run into stuff I can't figure out.
I'm trying to view a png preview stored in a ByteArray but I don't get it to work. I make the ByteArray a RWBinaryOrTextStream but the PNGReadWriter formFromStream: aStream do not recognize the format.
I'm not sure how to proceed.
I also tried to write out a png to the Journal but that would not work either :-(
Karl
Etoys mailing list Etoys@lists.laptop.org http://lists.laptop.org/listinfo/etoys
On 18.01.2009, at 20:27, Karl Ramberg wrote:
Walter Bender wrote:
Here is the Python/GTK way to do this, for what it is worth:
from sugar.datastore import datastore ... #my_dsobject is of type datastore.DSObject #object_id is a datastore object my_dsobject = datastore.get(object_id)
pixbufloader =
gtk.gdk.pixbuf_loader_new_with_mime_type('image/png') #Access the 'preview' property #Note that the preview image is 300x225 pixbufloader.write(dsobject.metadata['preview']) pixbufloader.close() pixbuf = pixbufloader.get_pixbuf()
-walter
Thanks. I got it working my self but there are quite a few of the previews that don't seem to work, and most criticaly photos from Record I can't get to work.
Many Journal entries do not have a preview. Some Journal entries do no even have an associated file.
- Bert -
etoys-dev@lists.squeakfoundation.org