4 echo "The output is <filename>_thumb.png"
8 CONVERT
="/home/roberto/RNF/ImageMagick/bin/convert"
10 #-- Source file without extension
11 SOURCE_NAME
=`basename $1 | awk -F. -v OFS=. '{$NF=""; sub("[.]$", ""); print}'`
14 THUMB_OUT
="${SOURCE_NAME}_thumb.png"
19 #-- Resized Thumbnail Mask
20 THUMB_MSK
="thumb_msk.png"
22 #-- Resized Thumbnail Lighting Overlay
23 THUMB_OVR
="thumb_ovr.png"
25 #-- Resize then crop off the parts of the image that overflows the desired size.
26 #$CONVERT $1 -thumbnail 100x100^ -gravity center -extent 100x100 ${THUMB_SRC}
27 #$CONVERT $1 -resize 100x100^ -gravity center -extent 100x100 ${THUMB_SRC}
28 $CONVERT $1 -resize 32x32^
-gravity center
${THUMB_SRC}
32 # -extent 48x48 ${THUMB_SRC}
33 $CONVERT $1 -gravity center
-extent 48x48
${THUMB_SRC}
35 #-- For lets generate a rounded corners mask for our thumbnail image.
36 #$CONVERT ${THUMB_SRC} -alpha off -fill white -colorize 100% \
37 # -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
38 # \( +clone -flip \) -compose Multiply -composite \
39 # \( +clone -flop \) -compose Multiply -composite \
40 # -background Gray50 -alpha Shape ${THUMB_MSK}
42 #-- For lets generate a rounded corners mask for our thumbnail image.
43 $CONVERT ${THUMB_SRC} -alpha off
-fill white
-colorize 100% \
44 -draw 'fill black polygon 0,0 0,7 7,0 fill white circle 7,7 7,0' \
45 \
( +clone
-flip \
) -compose Multiply
-composite \
46 \
( +clone
-flop \
) -compose Multiply
-composite \
47 -background Gray50
-alpha Shape
${THUMB_MSK}
49 #-- Now we have a 'shape mask' we want to use, I can apply the Aqua Effect
50 #-- effect to generate a lighting overlay, for this shape.
52 $CONVERT ${THUMB_MSK} -bordercolor None
-border 1x1 \
53 -alpha Extract
-blur 0x10 -shade 130x30
-alpha On \
54 -background gray50
-alpha background
-auto-level \
55 -function polynomial
3.5,-5.05
,2.05,0.3 \
56 \
( +clone
-alpha extract
-blur 0x2 \
) \
57 -channel RGB
-compose multiply
-composite \
58 +channel
+compose
-chop 1x1
${THUMB_OVR}
60 #-- With a final light/shade overlay image such as the above we can easily
61 #-- apply it to any thumbnail image of the right size.
63 $CONVERT ${THUMB_SRC} ${THUMB_OVR} \
( -clone 0,1 -compose Hardlight
-composite \
) \
64 -delete 0 -compose In
-composite ${THUMB_OUT}
66 #-- Remove intermediate files