Search code examples
imagemagickimage-resizingimagemagick-convert

Resize an image with 54x54 squares (540x540) to 54x54pixel lossless


I've got an 540x540 image of 54x54 color squares (same sizes).

When I resize it to 54x54px it looks horrible (blurred), shouldn't a resize like this be perfectly done with imagemagick?

is I possible to get it perfect?

I've tested convert source.png -resize destination.png and -adaptive-resize but the result is the same..


Solution

  • I see what your confusion is now... the problem is not that the process is lossy, rather it is because the -resize is doing more sophisticated processing than you want in order to make an attractive job that you would want for, say, photographs. You want a very simple point sampling process which will produce simple blocks of pure, uncombined colour.

    I'll make a start image:

    magick -size 10x10 xc:red +noise random -scale 540x540 start.png
    

    enter image description here

    And scale it down, by taking a point sample in each block:

    magick start.png -sample 10x10 small.png
    

    enter image description here

    And back up:

    magick result.png -scale 540x540 reincarnated.png
    

    enter image description here