arcking wrote:fmw42 wrote:convert \( $name -thumbnail "1000x1000" \) /home/web01/watermark.png -gravity center \
-compose modulate -define compose:args=50,100 -composite $ndir/$name
That runs, but doesn't preserve the transparency in the watermark. Also, pardon my bash ignorance, but why the escape characters?
The IM function only processes grayscale images as watermarks -- so it strips the alpha channel and converts the image to grayscale. See
http://www.imagemagick.org/Usage/compose/#watermark
If you want to preserve the alpha channel, then you probably want to try -compose dissolve, though I am not sure of the alpha channel when blending? Otherwise one can tone down one image before a simple composite. I will have to experiment some unless you can provide links to your two input images. Do both you input images have transparency?
In unix, parens must be escaped with the \. On windows, the escapes for parens are not needed.
From your code, you are only doing a convert and composite, which can be combined easily as:
convert \( $name -resize "1000x1000" \) /home/web01/watermark.png -gravity Center -composite $ndir/$name
The parens keep the -resize from affecting the next image. Perhaps not needed, but safest to avoid v5 backward compatibility in v6 from affecting the result. see also
http://www.imagemagick.org/Usage/basics/#parenthesis
This also seems to work to control the amount of the watermark image and keep transparency in both images:
convert \( $name -thumbnail "1000x1000" \) /home/web01/watermark.png -gravity center \
-compose
dissolve -define compose:args=50,100 -composite $ndir/$name
so you can change the 50 to a smaller/larger amount to make the watermark less/more prominent.
see
http://www.imagemagick.org/Usage/compose/#dissolve