#!/bin/bash
#http://www.imagemagick.org/Usage/color/
# Generate a test image for IM examples.
#
# The Image contains fully-transparent, half-transparent and fully-opaque
# reagions of the a full greyscale (black to white). It also contains regions
# of pure black, white, and other colors, so as to give IM a good workout when
# used in testing canvas and color modifications.
#
# This could actually be done all in one operation, but for debugging I like
# to be able to see the intermediate images.
#
####
#
# Anthony Thyssen Feburary 2004 <A.Thyssen@griffith.edu.au>
# Draw fancy horizontal gradient...
# convert -size 100x25 xc:white -size 100x100 gradient: -size 100x25 xc:black \
# -append -rotate 90 -blur 0x5 +repage test_gradient.png
convert -size 100x150 gradient: -rotate 90 \
-sigmoidal-contrast 7x50% test_gradient.png
# Create a semi-transparent rectangle of the gradient and flop it left-right
convert -size 150x100 xc:black \
-draw 'fill grey50 rectangle 8,8 142,92' +matte \
test_gradient.png +swap -compose CopyOpacity -composite \
-flop ${png_format}test_bgnd.png
# Draw two overlaping circles and fill then with same (non-flopped) gradient.
convert -size 150x100 xc:black \
-draw 'fill white circle 40,50 40,12' \
-draw 'fill white circle 110,50 110,12' +matte \
test_gradient.png +swap -compose CopyOpacity -composite \
test_fgnd.png
# Overlay the last two images and Add some extra colors to result.
convert test_bgnd.png test_fgnd.png -composite \
-draw 'fill green rectangle 40,64 110,96' \
-draw 'fill red circle 40,80 40,98' \
-draw 'fill blue circle 110,80 110,98' \
test.png
# Remove the intermediate images (comment if debugging)
rm -f test_gradient.png test_bgnd.png test_fgnd.png
# Overlay on the pages background color to generate a JPEG
# For stupid IE web clients that do not understand PNG transparency
#convert test.png \
# \( +clone -fill "$page_bg_color" -draw 'color 0,0 reset' \) \
# -compose Dst_Over -composite $jpg_opt test.jpg
# set permissions
chmod 644 test.png