If I make a screenshot of the the top left corner of the Safari window using Shift-Command-4 > Drag and paste it here on Stack Overflow, the red-yellow-green "traffic lights" and the icon next to them look twice larger compared to their real size.
According to magick identify -format "%w x %h, %x x %y\n" image.png
, it is 314 x 88 pixels, 144 x 144 PPI.
To paste it here on Stack Overflow and preseving its real width and height, I can use ImageMagick,
magick -units PixelsPerInch image.png -resample 72 image_imagemagick.png
or I can use the Preview app, which is incuded with macOS.
Menu bar > Tools > Adjust Size > Change Resolution from 144 to 72, and then change Width and Height to 50% > Press OK > Save it as image_preview.png
.
According to magick identify -format "%w x %h, %x x %y\n" *.png
, both the resulting images, image_imagemagick.png
and image_preview.png
, are 157 x 44 pixels, 72 PPI.
And now my questions.
First, if you look at both images precisely, you will see they are not really the same.
The first image, which is by ImageMagick, is blurrier. How, using ImageMagick, to produce a better one?
Second, is it correct that using ImageMagick is more "robust" in terms that resampling doesn't require us to manually adjust Width and Height? It seems the answer is "Yes, of course", but I want to be sure. It was somewhat an unpleasant surprise to me that to produce the same image as with ImageMagick, Preview requires, for some reason that I don't understand, to adjust Width and Height manually, whereas the Resample checkbox is already checked.
The original image is here: https://github.com/jsx97/test/blob/main/image.png. ImageMagick 7.1.1-31 Q16-HDRI aarch64 22148.
magick -list filter
for a list of filters. or justmagick image -filter XXX -resize 50% -density 72 output
magick image -filter XXX -resize 50% -density 72 output
. That should duplicated what you get from Preview, if you use the right filter. I do not know what Preview uses for its processing. Using this will maintain the image size in pixels and change the density to what you want. Pixel size is used for digital display, but density is only important for printing.