On Sat, May 16, 2015 at 5:28 PM, Merwan Ouddane <merwanouddane@gmail.com> 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: (Base64MimeConverter mimeDecodeToBytes: encodedImage).
Is this what you were searching for ?
Yes, this is cool! I understand that encodedImage is a ReadWriteStream. So, I use 'encodedImage contents' to get the code as string. Then I assigned the code to a variable, like that:
classVariable := 'iVBORw0KGgoAAAANSUhEUgAAAmAAAAIHCAIAAAC3HdQEQUJUQQJEcEAFRVE...' But I don't know how to transform it back. I tried the following: test := ReadWriteStream on: classVariable. ImageReadWriter formFromStream: (Base64MimeConverter mimeDecodeToBytes: test). But it doesn't work. It gives me an 'Error: image format not recognized' Do you know what I am missing here ? Thank you