wxHaskell: convert Data.ByteString to Image

180 views Asked by At

I have some raw data that represents an image as Data.ByteString. Is there a way in wxHaskell to convert it to an image/bitemap?

This raw data can be an image like PNG/JPG/GIF, so it will start with byte sequences like "PNG etc".

I tried to use "gd-3000" to create it, but I wasn't able to make "compatible" the output of that library with wx.

1

There are 1 answers

0
HJvT On

There seems to be no function to read such data from a ByteString, but there are functions to read images/bitmaps from file, see imageCreateFromFile and bitmapCreateFromFile from Graphics.UI.WX.Media. (If necessary, you could use a temporary file for these functions.)