Page 1 of 1

Re: resampling a png results in terrible output quality

Posted: 2007-11-26T13:58:42-07:00
by Bonzo
This gave a resonable result for me:

Code: Select all

convert test.png -resize 65x38 -filter Blackman testout2.png
The Blackman filter looks quite good; do you have access to php ? If you do try this code for the other filters if not PM me a link to an image and I will run it for you.

Code: Select all

<?php
// Build the array of filters to be used
exec("convert -list filter", $IMarray, $code);
// Start the loop to resize with the different filters
foreach ($IMarray as $value) {
$new_name = $value."_resize.jpg";
exec ("convert test.png -filter $value -resize 100x100 $new_name");
echo "<br><img src=\"".$new_name."\"width=\"100\"><br>";
echo $value;
}
?>

Re: resampling a png results in terrible output quality

Posted: 2007-11-26T19:41:31-07:00
by anthony
Using -sample to resize is not a good idea.

Using -resize is the better way. Using a Blackman filter produces a sharper resized image that the default Mitchell (slightly blurry), or Lanczos (slightly ringing) filter, though at a cost of some aliasing. See the re-vampled page on IM Examples, Resizing, for more details of these 'resize artifacts'

However the ideal way is to draw the font at the right size in the first place. Preferably with a font that is designed to be draw at very small pointsizes. There are some, such as the Libration, and DejaVu LGC fonts designed for use on Linux displays that do work at small scales.

Ideally a bitmap font should be available as an option in IM, which will allows for really small pointsized fonts (5 to 8 pixels high), however at this time IM fails in this regard. It is supposed to be able to handle it but I have as yet failed to get any bitmap font (non-Truetype) to work properly.