I'm using ImageMagick to downsample text. I realize that there's no such thing as the best filter for every situation, but I'm thinking there must be a generally-accepted standard when it comes to downsampling text specifically (I could be wrong). Here's the list of filters available in ImageMagick:
There is no generally-accepted downsampling filter; simply because, there's no generally-accepted type-face for text. You'll need to identify the font(s) your working with, and apply the best-matching filter for said task.
Visual comparision of each filter's stangth & weakness can be found here & here.
I like to remind myself which filter will meet a task by generating a visual cheat-sheet.
Here's a quick bash script previewing "DejaVu Sans Condensed"
#!/bin/bash
# Adjust this to type-face you'd like to preview
FONT_TO_PREVIEW="DejaVu-Sans-Condensed-Bold"
# Create a temp directory to work with
mkdir filter_tmp
cd filter_tmp
while read filter
do
# Generate base file
convert \
-gravity center -font $FONT_TO_PREVIEW -background white -size 126x \
-fill black -pointsize 12 label:$filter $filter.org.png
# Resample
convert $filter.org.png -filter $filter -resize 400% $filter.filter.png
# Crop center
mogrify -gravity center -crop 126x+0+0 +repage $filter.filter.png
# Tile filtered image below original
montage $filter.org.png $filter.filter.png -tile 1x2 -geometry +1+1 +label +set label $filter.png
# Clean house
rm $filter.filter.png $filter.org.png
# Generate list of all installed filters
done < <(identify -list filter)
montage -geometry +4+4 -tile 4x *.png ../filter_preview.png
# Clean house & display generated filter preview
cd ..
rm -rf filter_tmp
display -display :0 filter_preview.png
Your cheat sheet is not using some of the filters as recommended: Some of them are designed for use with "-distort Resize" instead of "-resize" (see here).
An additional recommendation: The choice of color space can really improve (or worsen) results. The ImageMagick Forums post "Enlarge with sRGB, RGB, LAB, LUV, XYZ, sigmoidal...?" (which I can't link here because, as a new user, I can only put two links per answer) illustrates this. With text, I recommend "sigmoidization" with a high contrast value (above 11). See here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With