I am using ImageMagick to reduce the image resolution, height and width.
I have noticed a few things. When I am changing resolution at “Image Size” through Photoshop (version 7) from 300dpi to 150dpi image height and width automatically change.
With ImageMagick however I am not getting such variations. For example, if image contains 878 width and 179 height at 300dpi, when changing it to 150 dpi, automatically the image width changing to 439 and height 89 respectively.
Can any one support me how to obtain such changes through ImageMagick.
2
Answers
The
dpi
setting is not really relevant in most imaging applications/areas, until the point at which you want to print an image.Do you really need to set it? I mean, if you want to half the size of an image, just use ImageMagick and do:
and ignore the dpi.
To resize the image keeping the rendered size the same, you can use the
-resample
option, like so:
Using your example, if the original is an 878×179 image at 300DPI,
the result is an 439×90 image at 150DPI:
You can alternatively use the
-density
option along with the
-resize
option to achieve the same effect:
In summary:
-density
just sets the DPI metadata without changing the underlying image;
-resize
changes the image size without changing the DPI;
-resample
changes the DPI and resizes the image accordingly.
Uses
The DPI metadata is relevant when you need to print an image or convert it to a PDF.
Now you can convert both images to PDF and get files with essentially the same page size: