aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-02-23 23:03:56 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-02-23 23:03:56 -0800
commit588a49acf983909907ea438e66cd88d3b21c6c9a (patch)
treed7577331cb33fc8c5de4169a327de18853683cbf
parentaa4105d190c638391908a14dc24158cfa5d119bc (diff)
downloadpandoc-588a49acf983909907ea438e66cd88d3b21c6c9a.tar.gz
ImageSize: Added Pdf to ImageType.
So far we have no function to determine PDF's size.
-rw-r--r--src/Text/Pandoc/ImageSize.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs
index f97cda28c..273a1a428 100644
--- a/src/Text/Pandoc/ImageSize.hs
+++ b/src/Text/Pandoc/ImageSize.hs
@@ -38,7 +38,7 @@ import Data.Bits
-- quick and dirty functions to get image sizes
-- algorithms borrowed from wwwis.pl
-data ImageType = Png | Gif | Jpeg deriving Show
+data ImageType = Png | Gif | Jpeg | Pdf deriving Show
data ImageSize = ImageSize{
pxX :: Integer
@@ -53,6 +53,7 @@ imageType img = case B.take 4 img of
"\x89\x50\x4e\x47" -> return Png
"\x47\x49\x46\x38" -> return Gif
"\xff\xd8\xff\xe0" -> return Jpeg
+ "%PDF" -> return Pdf
_ -> fail "Unknown image type"
imageSize :: ByteString -> Maybe ImageSize
@@ -62,6 +63,7 @@ imageSize img = do
Png -> pngSize img
Gif -> gifSize img
Jpeg -> jpegSize img
+ Pdf -> Nothing -- TODO
sizeInPixels :: ImageSize -> (Integer, Integer)
sizeInPixels s = (pxX s, pxY s)