diff options
| author | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-15 15:40:26 -0800 |
|---|---|---|
| committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-15 15:40:26 -0800 |
| commit | 691b7bdc66acdd5c9ac1f1b1800593995f117a71 (patch) | |
| tree | 5500591f10d7b20ac4da2662b02c7836620bcbde /src/Text/Pandoc/Writers | |
| parent | 28a043fe44bacb3e0e24b9f4e9402480d50d665a (diff) | |
| download | pandoc-691b7bdc66acdd5c9ac1f1b1800593995f117a71.tar.gz | |
ImageSize: extract dpi information from PNG and JPEG.
* ImageSize record now includes dpiX, dpiY, pxX, pxY.
* New functions sizeInPixels and sizeInPoints.
Diffstat (limited to 'src/Text/Pandoc/Writers')
| -rw-r--r-- | src/Text/Pandoc/Writers/ODT.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs index f5030e6d8..5c6f22ec6 100644 --- a/src/Text/Pandoc/Writers/ODT.hs +++ b/src/Text/Pandoc/Writers/ODT.hs @@ -37,7 +37,7 @@ import Codec.Archive.Zip import System.Time import Paths_pandoc ( getDataFileName ) import Text.Pandoc.Shared ( WriterOptions(..) ) -import Text.Pandoc.ImageSize ( readImageSize ) +import Text.Pandoc.ImageSize ( readImageSize, sizeInPoints ) import Text.Pandoc.MIME ( getMimeType ) import Text.Pandoc.Definition import Text.Pandoc.Generic @@ -104,11 +104,10 @@ transformPic :: FilePath -> IORef [Entry] -> Inline -> IO Inline transformPic sourceDir entriesRef (Image lab (src,tit)) = do let src' = unEscapeString src mbSize <- readImageSize src' - let pxToPoints px = px * 72 `div` 96 let tit' = case mbSize of - Just (w,h) -> show (pxToPoints w) ++ "x" ++ - show (pxToPoints h) - Nothing -> tit + Just s -> let (w,h) = sizeInPoints s + in show w ++ "x" ++ show h + Nothing -> tit entries <- readIORef entriesRef let newsrc = "Pictures/" ++ show (length entries) ++ takeExtension src' catch (readEntry [] (sourceDir </> src') >>= \entry -> |
