How to change image PPI in batch mode?

Is it possible to change an image resolution expressed in pixels per inch (PPI) in batch mode, using command line?

My images resolution is currently below 100 PPI.
I would like to enhance it to 300 PPI.
I am preparing a document for self publish.
The agency says that the images PPI should be 300.

1 Answer

Hello and welcome to Ubuntu.SE!

Here is a proposal using ImageMagick

You can use ImageMagick for that task:

Example

Here is a 40x30 pixels original image (file size of 1367 bytes) with a resolution of 72 PPI (in both X and Y directions):

original image

You can change its resolution using the following command:

convert -units PixelsPerInch my_original_image.jpg -density 300 my_new_image.jpg

This is the result of the previous command:

Changed PPI with density

X Resolution 300 PPI
Y Resolution 300 PPI
Image Size 40x30 pixels
File Size 981 bytes

Or if you need resampling:

convert -units PixelsPerInch my_original_image.jpg -resample 300 my_new_image.jpg

Which gives:

Changed PPI with resample

X Resolution 300 PPI
Y Resolution 300 PPI
Image Size 167x125 px
File Size 7.7 kB

Don't hesitate to open these images with Gimp for example to see the differences.



Source

More information


Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like