# line 1 - get dimensions of input psd
# line 2 - convert psd to sRGB
# line 3 - create same size gray image
# line 4 and 5 - extract alpha channel from watermark image and tile out the same size as psd
# line 6 overlay the gray image onto the base PSD (without alpha channel) using the watermark alpha channel
# line 7 add the alpha from the PSD with the tiled alpha from the watermark
# line 8 delete temps and put the combined alpha channel into the PSD replacing its old alpha with the combined one
Code: Select all
dim=`convert W_MYAG_F7956_14021_001X.psd[0] -format "%wx%h" info:`
convert \( W_MYAG_F7956_14021_001X.psd[0] -colorspace sRGB \) \
\( -clone 0 -fill "gray(50%)" -colorize 100 \) \
\( LimitedUsePSD.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
\( -clone 0 -clone 1 -clone 2 -alpha off -compose over -composite \) \
\( -clone 0 -alpha extract -clone 2 -compose over -compose plus -composite \) \
-delete 0-2 -alpha off -compose over -compose copy_opacity -composite result.png