@@ -115,13 +115,13 @@ imageType img = case B.take 4 img of
115 -- B.groupBy openingTag matches first "<svg" or "<html" but not "<!--"
115 -- B.groupBy openingTag matches first "<svg" or "<html" but not "<!--"
116 openingTag x y = x == '<' && y /= '!'
116 openingTag x y = x == '<' && y /= '!'
118−imageSize :: ByteString -> Either String ImageSize
118+imageSize :: WriterOptions -> ByteString -> Either String ImageSize
119−imageSize img =
119+imageSize opts img =
120 case imageType img of
120 case imageType img of
121 Just Png -> mbToEither "could not determine PNG size" $ pngSize img
121 Just Png -> mbToEither "could not determine PNG size" $ pngSize img
122 Just Gif -> mbToEither "could not determine GIF size" $ gifSize img
122 Just Gif -> mbToEither "could not determine GIF size" $ gifSize img
123 Just Jpeg -> jpegSize img
123 Just Jpeg -> jpegSize img
124− Just Svg -> mbToEither "could not determine SVG size" $ svgSize img
124+ Just Svg -> mbToEither "could not determine SVG size" $ svgSize opts img
125 Just Eps -> mbToEither "could not determine EPS size" $ epsSize img
125 Just Eps -> mbToEither "could not determine EPS size" $ epsSize img
126 Just Pdf -> Left "could not determine PDF size" -- TODO
126 Just Pdf -> Left "could not determine PDF size" -- TODO
127 Nothing -> Left "could not determine image type"
127 Nothing -> Left "could not determine image type"
@@ -286,10 +286,9 @@ gifSize img = do
287 _ -> Nothing -- "GIF parse error"
287 _ -> Nothing -- "GIF parse error"
289−svgSize :: ByteString -> Maybe ImageSize
289+svgSize :: WriterOptions -> ByteString -> Maybe ImageSize
290−svgSize img = do
290+svgSize opts img = do
291 doc <- Xml.parseXMLDoc $ UTF8.toString img
291 doc <- Xml.parseXMLDoc $ UTF8.toString img
292− let opts = def --TODO: use proper opts instead of def, which simply contains dpi=72
293 let dpi = fromIntegral $ writerDpi opts
292 let dpi = fromIntegral $ writerDpi opts
294 let dirToInt dir = do
293 let dirToInt dir = do
295 dim <- Xml.findAttrBy (== Xml.QName dir Nothing Nothing) doc >>= lengthToDim
294 dim <- Xml.findAttrBy (== Xml.QName dir Nothing Nothing) doc >>= lengthToDim