Tuesday, January 7, 2014

Check sharpening modes with imagemagick for blogging

Blogging needs pictures - and the pictures need to be good and small. To reduce pictures in size, I use imagemagick and run it on a folder like described with this recent script.

Depending on the source and target size of the picture, darkness and details various settings are getting the best results - there is not one best setting. So how to efficiently figure out which is best?

I move the pictures I want to use in a separate folder, and then run below script to check several settings in the 'unsharp' mask. Then I just open them in a viewer, and flip back / forth between pictures, delete the less good one until I am left with the one I will use.
#!bash
if [[ ! -d $1 ]]
then mkdir "$1"
fi
for i in *.jpg
do echo "processing $i"
convert "$i" -resize "${1}>" -quality 25%  "$1"/"$i"_0s    # no sharpen
convert "$i" -resize "${1}>" -quality 25% -unsharp 1.2x1.2+1+0 "$1"/"$i"_1s   # best with raffia - high contrast
convert "$i" -resize "${1}>" -quality 25% -unsharp 1.2x1.2+0.5+0 "$1"/"$i"_2s # best for 600 px tent (dark)
convert "$i" -resize "${1}>" -quality 25% -unsharp 0x1.2+0.5+0 "$1"/"$i"_3s # best for 800px tent
convert "$i" -resize "${1}>" -quality 25% -unsharp 0x1.2+5+0 "$1"/"$i"_4s # good with raffia
convert "$i" -resize "${1}>" -quality 25% -unsharp 0x1.4+5+0 "$1"/"$i"_5s # good with raffia
convert "$i" -resize "${1}>" -quality 25% -unsharp 1.5x1+0.7+0.02 "$1"/"$i"_6s # forum 2 // good outside
convert "$i" -resize "${1}>" -quality 25% -unsharp 0x0.75+0.75+0.008 "$1"/"$i"_7s # forum 1 // good outside
convert "$i" -resize "${1}>" -quality 25% -unsharp 0x6+0.5+0 "$1"/"$i"_8s # gimp   // good outside

done
It has a little shortcut - linux seems not to care about the file ending (jpg), and displays the files fine. this way I can have the filename first, and then the variation number of the script. While in the photo viewer, this helps to have all variations of the same picture after each other for the back / forth deletion process. At the end I just need to rename the final picture for use.

No comments:

Post a Comment

Bookmark and Share