Reputation: 30579
I have a small pixel map and want to resize it for better readability.
Using mogrify -resize 1600%
I get an interpolated image: .
What I'm trying to get is this: .
Can this be done by ImageMagick or any other open source command line tool?
Upvotes: 27
Views: 11546
Reputation: 1721
display -sample 400%
worked for me.
"Change the image size simply by directly sampling the pixels original from the image. When magnifying, pixels are replicated in blocks. When minifying, pixels are sub-sampled (i.e., some rows and columns are skipped over)."
https://imagemagick.org/script/command-line-options.php#sample
Upvotes: 2
Reputation: 1054
To keep the original values of the input image and avoid any blend or bluriness, you can use -interpolate nearest-neighbor
or -interpolate integer
.
It only works along -interpolative-resize
. Be aware that -resize
does not work correctly with -interpolate
. You can check here on the imagemagick docs.
e.g.
convert input.png -interpolate nearest-neighbor -interpolative-resize 1600% output.png
Upvotes: 0
Reputation: 16197
This worked for me:
convert input.png -interpolate Integer -filter point -resize "10000%" output.png
Explanation:
Upvotes: 13
Reputation: 30579
I finally found the solution: using -scale
instead of -resize
does the trick. It is 'hidden' under the heading Scale - Minify with pixel averaging, therefore I overlooked it at first, searching for magnification instead of minification.
Upvotes: 26