-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image height in % does not retain image aspect ratio for odt output #3239
Comments
Here's the relevant code: let dims =
case (getDim Width, getDim Height) of
(Just w, Just h) -> [("width", show w), ("height", show h)]
(Just w@(Percent _), Nothing) -> [("width", show w), ("style:rel-height", "scale")]
(Nothing, Just h@(Percent _)) -> [("style:rel-width", "scale"), ("height", show h)]
(Just w@(Inch i), Nothing) -> [("width", show w), ("height", show (i / ratio) ++ "in")]
(Nothing, Just h@(Inch i)) -> [("width", show (i * ratio) ++ "in"), ("height", show h)]
_ -> [("width", show ptX ++ "pt"), ("height", show ptY ++ "pt")]
where
ratio = ptX / ptY
getDim dir = case (dimension dir attr) of
Just (Percent i) -> Just $ Percent i
Just dim -> Just $ Inch $ inInch opts dim
Nothing -> Nothing As you can see, when a percent is used, we use |
Hi, I just ran into this issue (Pandoc 1.19.2.1, LibreOffice 5.3.0.3). Using
ODT output:
Somehow this is not enough for ODT. It seems that it needs both
I couldn't figure out if this is a ODT bug or feature, but perhaps a workaround would be Pandoc calculating the ratio percentage on its own, if |
Indeed, this seems to be a known bug in LibreOffice, reported in 2012. I'll take a look... |
Reproducibility
When an image link is included in markdown input one can give the image width and image height. Providing only the image width should keep the image aspect ratio in the output dcument. It does when the unit is 'cm' or 'px'. It does not when unit is '%'.
[A Screenshot](screenshot.png){width=15%}
==> The image in the odt file has its image scaled ok horizontaly, but it does not retain its ascpect ratio. Using {width=15cm} does work as expected.
expected behaviour
When image width is given explicitly as in {width=x%} without giving the image height I expect the aspect ratio to be kept the same.
version
pandoc 1.18
The text was updated successfully, but these errors were encountered: