Mick
Mick

Reputation: 1561

ImageMagick Antia-aliasing

I am trying to resize and pad some images, without anti-aliasing:

convert test.bmp -resize 200x200 -background white -gravity center -extent 200x200 -monochrome

but I get anti-aliasing (grey pixels), I have tried adding +antialias but it doesn't seem to work.

Should this work?

Mick

Amended after trying with scale.

Here is the original image: enter image description here

Here is the image after

convert cp10.bmp  -scale 200x200 -background white -gravity center -extent 200x200 test.bmp

enter image description here

Upvotes: 3

Views: 1253

Answers (1)

Wander Nauta
Wander Nauta

Reputation: 19675

By default, -resize will use a Mitchell or Lanczos filter for the resizing, depending on the image. Those work well for most images, but if you don't want their smoothing effect (say, if you're scaling pixel art), try -scale instead of -resize, or choose a different filter (scale uses -filter box).

As an example, here is pattern:checkerboard:

enter image description here

With -resize 64x64:

enter image description here

With -scale 64x64:

enter image description here

Upvotes: 5

Related Questions