1

I use LaTeX to create a PDF which I then crop using PDFCrop. From there I go to PNG using ImageMagick. I then insert the PNG into a software program which displays it on my screen - laptop, desktop, or mobile.

Problem: The PNG is not displaying perfectly crisp.

Question: Which parameter values such as DPI/density and scaling should I use in ImageMagick to get a perfectly crisp PNG?

ImageMagick line: magick convert -alpha off -density 600 XXX.pdf -scale 25%% XXX.png

I tried a density of 1000 and scaling down to 12.5% and it was an okay width but it was blurry.

Here is the cropped PDF output from PDFCrop which looks perfectly crisp:

PDFCrop output

Here is the ImageMagick PNG output using parameters 600 for density and 25% for scaling (good width and height but not perfectly crisp):

IM PNG output

Here is the output of the software program displaying the PNG on a laptop:

enter image description here

13
  • 1
    You do realize the PDF is most likely vector based.. while PNG is always raster based.
    – Scott
    Oct 24, 2021 at 3:45
  • No, I did not. I'm not sure of the difference. Can that help me in any way? Oct 24, 2021 at 4:20
  • I can only use an image file for this application; I cannot use a pdf, for example. Oct 24, 2021 at 4:27
  • 2
    @UngarLinski it will depend on many factors. Your phone or other device dimensions and resolution, how will you display the image in phone.
    – Vikas
    Oct 24, 2021 at 10:45
  • 1
    @UngarLinski in my web and mobile experience, I don't think scaling a big image down make it appear better. I was always told to use original size wherever possible. Also, DPI don't matter in screen I think.
    – Vikas
    Oct 24, 2021 at 15:52

1 Answer 1

1

Scale the original PDF in a proper PDF viewer program so that the wanted formula is shown in the final wanted screen size and take a screenshot. That screenshot is as good as the rendered vector image can be on the screen. If you watch that screenshot in Photoshop or other bitmap image program with high zoom in you'll see it's not at all sharp, it has got just that mathematically decided amount of blur that it looks as sharp as possible on the screen.

To stay in truth in the rendering process vector symbols are moved surgical amounts (=hinted) to make possible to render them well with the least possible amount of blur.

You can see the same if you take a screenshot of this text and watch it in Photoshop in 400% size or bigger.

I do not have ImageMagick, but I guess an exported PNG is as good.

Your problems start when the exported PNG is scaled. PNGs nor other bitmap images cannot be scaled without making them either unsharp or jaggy.

The only way to show the exported bitmaps as sharp is to show them in their original pixel sizes so that every bitmap pixel is shown as a real screen pixel.

Unfortunately I have no idea what application will be used to show your images and how you can guarantee they are not scaled, not at least when shown in default size.

4
  • 1
    No its not. Imagemagick indeed does a better job (or atleast does a better job than acrobat, illustrator and photoshop) you just need know how many pixels you need. If you use density and percent scale tgeres no way of knowing the right size.
    – joojaa
    Oct 24, 2021 at 9:21
  • I'm afraid the improvement achieved by using IM doesn't fix the blurriness caused by scaling a PNG in an application program.
    – user82991
    Oct 24, 2021 at 16:47
  • Imagemagic uses ghostscript to render the vector graphix to pixels so you can sample it correctly. But actually since moat graphics cards work linear correctly, if you do the same in imagemagick (whiçh op does not do) then the multipixel filter of imagemagic behaves better in resampling than any adobe output.
    – joojaa
    Oct 24, 2021 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.