Re: [Pharo-users] Store a png in a class variable

2015-05-17 Thread Sven Van Caekenberghe
"Quick and easy way to get an image from a URL" ZnEasy getPng: 'http://www.pharo.org/files/pharo.png'. "Turn bytes into an image inside Pharo" (PNGReadWriter on: 'http://www.pharo.org/files/pharo.png' asUrl retrieveContents readStream) nextImage. "Store image bytes as Base64 and recreate the ima

Re: [Pharo-users] Store a png in a class variable

2015-05-16 Thread Leonardo Silva
On Sat, May 16, 2015 at 5:28 PM, Merwan Ouddane wrote: > You can encore your image in base64 > anImage := 'holidays.png' asFileReference readStream binary. > encodedImage := Base64MimeConverter mimeEncode: anImage. > > > Then you can decode it with: > ImageReadWriter formFromStream: (

Re: [Pharo-users] Store a png in a class variable

2015-05-16 Thread Merwan Ouddane
You can encore your image in base64 anImage := 'holidays.png' asFileReference readStream binary. encodedImage := Base64MimeConverter mimeEncode: anImage. Then you can decode it with: ImageReadWriter formFromStream: (Base64MimeConverter mimeDecodeToBytes: encodedImage). Is this what

Re: [Pharo-users] Store a png in a class variable

2015-05-15 Thread Peter Uhnák
You can also use this utility to simplify generation of the array. http://smalltalkhub.com/#!/~peteruhnak/IconFactory Peter On Fri, May 15, 2015 at 9:37 PM, stepharo wrote: > Look at the icons because they are managed like an encoded byte array. > > > Le 15/5/15 21:11, Leonardo Silva a écrit :

Re: [Pharo-users] Store a png in a class variable

2015-05-15 Thread stepharo
Look at the icons because they are managed like an encoded byte array. Le 15/5/15 21:11, Leonardo Silva a écrit : Hi, I load a PNG file using the code below: pngPath := '/Users/Somefolder/UI-Theme.png' asFileReference. forms := pngPath readStreamDo: [ :in | (PNGReadWriter on: in) nextImage

[Pharo-users] Store a png in a class variable

2015-05-15 Thread Leonardo Silva
Hi, I load a PNG file using the code below: pngPath := '/Users/Somefolder/UI-Theme.png' asFileReference. forms := pngPath readStreamDo: [ :in | (PNGReadWriter on: in) nextImage ]. ... But I don't want to create this dependency with a file path. I would like to be able to encode the image into a