4

There is a useful tool in MikTeX called dvipng, which can transform dvi file to png file.

My question is about the useage of this command. I usually use it with options

-T tight -D 120 -z 9 -bg Transparent

,

but sometimes pictures output are not clear enough when printed on papers,

enter image description here

so I increased the dpi to 1200 in order to make them more clear:

-T tight -D 1200 -z 9 -bg Transparent

.

Despite of it goes more clear indeed, the size of the picture, out of my expectation, increased 99 times at the same time.

enter image description here

I want to increase the dpi without increasing the size of the picture, so how to realize it?

Popopo
  • 831
  • 1
    dvipng is not a MiKTeX tool, it is just included there as well as in TeX Live. – Speravir Apr 23 '13 at 17:12
  • Could you explain what the goal of making PNG from DVI is? Then someone might suggest an alternative solution. – amorua Apr 23 '13 at 18:01
  • 1
    @amorua Okay, no problem. My goal is paste formulae as png into doc files, but I found 120dpi is not clear enough, 1200dpi is much better but needs to have a shrinking manually. So what I'm seeking is to make high quality pictures with standard size. – Popopo Apr 24 '13 at 04:04
  • @Popopo Option 1: Retype in .doc with inbuilt math or mathtype incase of few equations Option 2: Check 200/300 dpi png compromising quality over size(math in png is not recommended choice last resort). – texenthusiast Apr 24 '13 at 04:26
  • @Popopo: To add tex formula's as png into doc you may give this tool a try: http://sourceforge.net/projects/texsword/ It automates the process and keeps editable equations inside doc-file. It also allows numbering and referencing of equations. – amorua Apr 27 '13 at 19:27
  • @amorua It sounds good, but unfortunately incompatible with word 2013... – Popopo Apr 28 '13 at 11:42

1 Answers1

6

A short (non-technical) answer is: it is impossible to do with dvipng

A longer (technical) answer is: the problem is that dvipng does not include a so called pHYs chunk in the PNG file it makes. This chunk contains the information about the size (in meters) of the pixel.

So, if your vector image is 1in x 1in and you render it to PNG with an option "-D 120", you'll get an image with dimensions of 120 x 120 pixels and there'll be no further information about resolution included in the PNG file.

See also https://web.archive.org/web/20130512151707/http://list-archives.org/2012/10/14/dvipng-nongnu-org/does-dvipng-include-the-dpi-information-in-its-output/f/6630375274

asmeurer
  • 454
amorua
  • 1,928