-
-
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
Syntax for specifying image size #261
Comments
Comment 2 by [email protected], Nov 10, 2010 |
Duplicate of #61 ? |
I'd like to say for the record that all of the advice for image manipulation (see above) doesn't help at all when dealing with vector image formats (svg, TikZ, pdf, etc.). This issue is quite the wrench. |
@jgm mentions that
I'm not sure what that means. Where does one specify the header of one of these image files? I assume this isn't in reference to the bytes of the image file itself. |
+++ pckujawa [Apr 22 13 00:53 ]:
The DPI is stored in metadata in the header of the image files.
|
Ah, so you were referring to the bytes in the image file itself. That For anyone else using latex, I did find that \includegraphics does not work
So if you want to use latex and \includegraphics[width=...], you need to Thanks for pandoc! On Mon, Apr 22, 2013 at 9:43 AM, John MacFarlane - [email protected]
|
From what I understand, there is no consensus on markdown syntax to specify the width of an image. For that reason, width specifications are not supported. |
Similar to HTML+CSS, ConTeXt allows you to specify the dimensions of individual figures. You can create a
Then generate a ConTeXt file using
and compile it using
|
@adityam Thanks, good to know. |
Just a note: if image size should be specified in Pandoc Markdown, one must be able to specify at least two kinds of sizes: first the size in cm or inch for PDF, DocBook, Word etc. and second the size in pixels for HTML, EPUB and related output formats. For bitmap image files both can also be specified in the image files but vector image files usually contain no pixel dimensions. |
A TeX hack to get floating images in ConTeXt is to redifine
|
This issue is about changing figure size, and not its floating behavior. By default,
gives
Do you want to change the floating behavior (from
and set the default floating behaviour using |
I just discovered that in HTML you can do
This resolves the problem about how to convert between pixels and other measurements; we'll just let the browser handle that. |
Note that in almost all browsers, 1 in (and equivalently 2.54 cm) is simply shorthand for 96 pixels. |
Here is what multimarkdown does:
I like the basic idea. I'd like to allow something similar in inline images and links:
Some questions and potential difficulties:
and in inline form,
or should it be
would be parsed as a link to the URL |
Is this hard coded in the browsers, or is it sensitive to the system On linux, at least, you can change the system DPI: +++ Tim Lin [Oct 21 13 13:05 ]:
|
I'm all for
So we have each type of bracket besides the others |
👍 for |
@jgm: As far as I can tell, this convention is part of the official CSS specification and does not obey variations in OS or device. I think there's currently no reliable method to have perfect physical sizing control short of probing for the actual physical device, and I'm not sure ultimately how useful it is anyways. IMO one of the best practices is to use widths relative to the container. In LaTeX I've always used something like |
I kind of agree with @evitaerc. I do that always, too, for LaTeX. But although LaTeX has a fixed page width, that is not true for HTML. But we can always support both (relative or absolute). |
@mb21 and @ambs: So how would you expect to specify the size of an image for both, LaTeX/PDF and HTML/EPUB format? The original image will unlikely have 96 DPI. This would not work, would it?:
Its usual to create PDF and HTML from the same Markdown source. If the proposed syntax cannot support both of them at the same time, one must manually change the image file as it is needed now. A possible solution with limited usability is to support a "dpi" parameter. For instance 5cm / 203DPI = 400px:
|
@ambs: HTML at least has the container width that you can almost always count on. Having a width relative to the container width is also ideologically closer to the current almost de-facto system of rendering on a column/grid system for CSS (think of percentages like laying out a picture across 100 columns). On the other hand, absolute sizes like pixels will test your resolve to live when you want to make it work for high-DPI handheld devices and 4K desktop displays. |
I like @nichtich's suggestion to have separate dimension specification for HTML and LaTeX (pdf output). You do not want to fixate pixel to an actual physical measurement. This is in my opinion the best way to go. Other than the default case:
One may optionally include dimensions for either HTML or LaTeX:
If either dimensions for HTMl and LaTeX are excluded, then they're assumed to be default and handled by the browser or LaTeX pdf compiler accordingly. Other cases may include that, if you only include How do we separate attributes for either LaTeX and HTML? For instance, Does anyone know if LaTeX throws an error if you just dump the attributes into: |
I don't see the need for the complexity of separate measures for |
|
Added my comment about the div syntax (mentioned in prev comment here) to the end of issue #168. |
@jgm If that's the case, would you at least allow the |
Personally, I usually want to use a |
👍 Slick. Thanks @jgm! |
\o/ |
Awesome! Thx! |
WEEEEEEEEE!!! |
Merci! ☀️ |
This is huge, thanks! 👍 |
Cool, but this won't be available in a full release until 1.16, right? I can't create a windows version of this branch using either stack or cabal. |
+++ TIm St.Clair [Nov 22 15 17:41 ]:
What happens on Windows when you try with stack? |
Windows 2003 R2 Sp2 32-Bit, on VirtualBox; git, node, cygwin, miktex, haskell platform, cabal, etc all installed and updated ok. (ghc version 7.8.3) $ stack install , and, when compiling via cabal, I also get cryptonite can't be installed (cryptonite: random: cannot get any source of entropy on this system). |
https://hackage.haskell.org/package/cryptonite Is Windows 2003 < Windows 8? If so, that's your problem. +++ TIm St.Clair [Nov 22 15 21:19 ]:
|
slaps forehead i really have to trash that old thing and stop using it. |
I really want this feature but can't get Pandoc to build with stack on Windows 10. Followed the instructions from https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc, downloaded the latest
Which has something to do with a Haskell HTTP library. Is there any other way to get this feature? Or is there something about Haskell on windows that I'm overlooking. |
Someone has reported the same issue on pandoc-discuss. +++ Greg Bernstein [Dec 08 15 11:31 ]:
|
Thanks. It's a windows/Haskell issue, using a VM was able to build it on Ubuntu and see first hand this really nice feature. I'll watch pandoc-discuss for the windows fix. |
Is there an estimate of when this feature will reach the release? |
Image dimensions have been in 1.16 for a while already... |
Oops, my bad! |
How do you use it btw? I can't seem to find instructions on using it in the manual. |
Search for See here: http://pandoc.org/README.html#images |
It seems this only works with the width and height keyword. I would love to be able to do something like this:
Am I missing something or is this really impossible yet? edit: I care about the latex backend So as desired output I would like to have: |
Similarly to @flrgsr I would like to be able to scale images, mainly so that I don't need to make all my images super low-res and/or hardcode the image sizes in the markdown just to accommodate the scaling with HTML (which is super low DPI per default). |
It sounds what you guys are really looking for is:
|
Yes! Is there a nicer way to write that? Also, does that work with all backends (e.g. both PDF and HTML)? Edit: also if this actually scales up/down the pixels before inserting the image that doesn't help, since then it will reduce the resolution. I can do that myself in GIMP - the point is scaling down the size without reducing the image resolution to support high DPI output properly |
Depending on your taste, it's already quite nice.. (at least it's consistent with other syntax) see http://pandoc.org/MANUAL.html#extension-link_attributes for the rationale. No, if you generate your PDF with LaTeX (which is the default), it will use |
So what about HTML? HTML is one of my required main targets so if it's not working nicely there, sadly I can't really use it. Filters are often mentioned here, but I consider them quite uninteresting since they require something outside markdown. Similar to CSS, except CSS is even a lot worse since it requires specific stuff for one output format only. Write once in a universal format, output to all targets shouldn't require this.. |
What about it? Tell us what HTML you expect pandoc to generate for what input...
That's not correct. Filters are for you to customize pandoc's behaviour, see https://pandoc.org/scripting.html But this discussion/QA should move to pandoc-discuss. This issue is closed and we're spamming the people subscribed to it. |
Googlecode Issue #29
There is currently no way to specify the size of an image.
For some ideas, see http://code.google.com/p/pandoc/wiki/ImageSizes.
The text was updated successfully, but these errors were encountered: