Commit 69db704d authored by Christoph Ruegge's avatar Christoph Ruegge

Read binary files as ByteString

parent 807f8c97
......@@ -37,7 +37,7 @@ chartData renderable format = do
mkFile opts filename renderable
-- Convert to base64.
imgData <- fmap Char.pack $ readFile filename
imgData <- Char.readFile filename
return $
case format of
PNG -> png width height $ base64 imgData
......
......@@ -60,8 +60,8 @@ displayImageAsJpg renderable = do
-- Write the image
saveJpgImage 95 filename renderable
-- Convert to base64.
imgData <- readFile filename
return $ Display [jpg (imWidth renderable) (imHeight renderable) $ base64 (CBS.pack imgData)]
imgData <- CBS.readFile filename
return $ Display [jpg (imWidth renderable) (imHeight renderable) $ base64 imgData]
-- The type DynamicImage does not have a function to extract width and height
imWidth :: DynamicImage -> Int
......
......@@ -28,7 +28,7 @@ figureData figure format = do
writeFigure format fname (w, h) figure
-- Read back, and convert to base64.
imgData <- Char.pack <$> readFile fname
imgData <- Char.readFile fname
let value =
case format of
PNG -> png w h $ base64 imgData
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment