Skip to content

Instantly share code, notes, and snippets.

@pavel-perina
Last active June 7, 2017 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavel-perina/0552c5ecc7349f2b709d4bd81f502ddd to your computer and use it in GitHub Desktop.
Save pavel-perina/0552c5ecc7349f2b709d4bd81f502ddd to your computer and use it in GitHub Desktop.
Subpixel image resizing using imagemagick convert
#!/bin/sh
convert ResizeTestImage.png -gamma 0.5 -filter Mitchell -resize 800x200! -morphology Convolve "3x1: 0.33, 0.34, 0.33" -channel Red -morphology Convolve "3x1: 0.0, 0.0, 1.0" -channel Green -morphology Convolve "3x1: 0.0, 1.0, 0.0" -channel Blue -morphology Convolve "3x1: 1, 0, 0" +channel -filter Point -resize 267x200! -gamma 2.0 -depth 8 ResizeTestSubpixel.png
@pavel-perina
Copy link
Author

pavel-perina commented Jun 7, 2017

Resize with subpixel accuracy (cleartype)
Based on i believe this thread http://www.imagemagick.org/discourse-server/viewtopic.php?t=19120 and here is the result of image downscaled from 800x600 to 267x200 pixels. Bottom image is for comparison.

result

I believe it's more suitable for vector graphics (fonts, graphs, ...) and photos seem to be more blurred

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment