How to change DPI of a PNG file? (in command line, without ImageMagick)

johndodo

I am looking for a way to change the DPI on PNG image files. Using ImageMagick this is easy:

$ convert -density 150 -units pixelsperinch file.png file.png

The problem is that I will run this command from my application, running on multiple VMs, which don't have ImageMagick installed. I can push the upgrade packages to these VMs, but in case of ImageMagick that would add about 30MB to an upgrade bundle, which is a bit too much for my use case.

Long story short: is there a way I can change the DPI on a PNG file using a small (as in package size) command-line tool?

Optionally, changing bytes in a raw image file would be okay too, if someone knows where to look for them...

nixda

Is 2.10 MB small enough? If yes, use NConvert and a batch command like:

nconvert -out png -dpi 150 -keepdocsize -keepfiledate mysource.png

What is NConvert for?

XnView is a GUI-based application, you can change and manipulate images using a graphical user interface. NConvert has about the same capabilities as XnView, but it is a command line tool and has no graphical user interface. You can use NConvert in Batch scripts or another application can call it.

Helpful links

  • Beginner guide and Wiki with some examples to start
  • Help file to see what command line parameters are available (Uploaded on pastebin)
  • A graphical front-end using Nconvert is XnConvert. Use this to create & export Nconvert batch files
  • Forum for Xnconvert and Nconvert for

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

inkscape command line svg to png - set both width and dpi

From Dev

How to get the DPI of an image file (PNG)

From Dev

ImageMagick command without intermediary file fails

From Dev

How to use ImageMagick command line on Windows?

From Dev

Gnuplot png file without border line

From Dev

I want to change DPI with ImageMagick without changing the actual byte-size of the image data

From Dev

How to replace an email in a (PHP) file from the command line without sed?

From Dev

How to replace an email in a (PHP) file from the command line without sed?

From Dev

How to change/add a tracker to a .torrent file using the command line?

From Dev

How do I change file headers from the command line?

From Dev

How to change command line executable?

From Dev

How to change mouse DPI?

From Dev

how to compress image using imagemagick + command line string + php?

From Dev

Execute Batch File without Command line visible

From Dev

Imagemagick cropping thumbnail command line

From Java

How to convert a SVG to a PNG with ImageMagick?

From Dev

Change line in text file from other text file with command line

From Dev

Change line in text file from other text file with command line

From Dev

PHP converting an SVG to PNG WITHOUT ImageMagick

From Dev

How do I only change one specific line in a foriegn batch file, without affecting any other line?

From Dev

How do I replace a file in an ISO file without needing root from the command line

From Dev

Changing the DPI in a JPEG without re-encoding? with ImageMagick or something else

From Dev

How do I change the canvas size of a PNG with ImageMagick (GraphicsMagick)? (How to pad with transparency?)

From Dev

Overriding High DPI Scaling from the Command Line

From Dev

How to use Remote File within Imagemagick Command in PHP

From Dev

Imagemagick command in command line and windows powershell

From Dev

How to convert GIF files to PNG or JPEG in OS X with command line?

From Dev

NoDecodeDelegateForThisImageFormat Error reading .png file with ImageMagick

From Dev

How can I view the contents of tar.gz file without extracting from the command-line?

Related Related

  1. 1

    inkscape command line svg to png - set both width and dpi

  2. 2

    How to get the DPI of an image file (PNG)

  3. 3

    ImageMagick command without intermediary file fails

  4. 4

    How to use ImageMagick command line on Windows?

  5. 5

    Gnuplot png file without border line

  6. 6

    I want to change DPI with ImageMagick without changing the actual byte-size of the image data

  7. 7

    How to replace an email in a (PHP) file from the command line without sed?

  8. 8

    How to replace an email in a (PHP) file from the command line without sed?

  9. 9

    How to change/add a tracker to a .torrent file using the command line?

  10. 10

    How do I change file headers from the command line?

  11. 11

    How to change command line executable?

  12. 12

    How to change mouse DPI?

  13. 13

    how to compress image using imagemagick + command line string + php?

  14. 14

    Execute Batch File without Command line visible

  15. 15

    Imagemagick cropping thumbnail command line

  16. 16

    How to convert a SVG to a PNG with ImageMagick?

  17. 17

    Change line in text file from other text file with command line

  18. 18

    Change line in text file from other text file with command line

  19. 19

    PHP converting an SVG to PNG WITHOUT ImageMagick

  20. 20

    How do I only change one specific line in a foriegn batch file, without affecting any other line?

  21. 21

    How do I replace a file in an ISO file without needing root from the command line

  22. 22

    Changing the DPI in a JPEG without re-encoding? with ImageMagick or something else

  23. 23

    How do I change the canvas size of a PNG with ImageMagick (GraphicsMagick)? (How to pad with transparency?)

  24. 24

    Overriding High DPI Scaling from the Command Line

  25. 25

    How to use Remote File within Imagemagick Command in PHP

  26. 26

    Imagemagick command in command line and windows powershell

  27. 27

    How to convert GIF files to PNG or JPEG in OS X with command line?

  28. 28

    NoDecodeDelegateForThisImageFormat Error reading .png file with ImageMagick

  29. 29

    How can I view the contents of tar.gz file without extracting from the command-line?

HotTag

Archive