Watermarking Transparent PSD Image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Watermarking Transparent PSD Image

Post by fmw42 »

try this (unix syntax):

# 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
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: Watermarking Transparent PSD Image

Post by pssvarma8881 »

Hi ,

This is working for some of the images,Thanks for you help .

Since We have got complex PSD with multiple Layers the above command not working for all images .

Is there a way to remove the Transparent background and Replace with With White background then we do watermark ?

Thanks in advance
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Watermarking Transparent PSD Image

Post by fmw42 »

Did you try

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 \
-background white -compose over -flatten result.png
or simpler

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 -background white -flatten \) \
\( -clone 0 -fill "gray(50%)" -colorize 100 \) \
\( LimitedUsePSD.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite \
result.png 

But what does this have to do with multilayer PSD
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: Watermarking Transparent PSD Image

Post by pssvarma8881 »

Hi

Just tried these commands and there are working with all the PSD .there are some PSDs for which watermarking is coming up but original Image was missing from the PSD .

Thanks for your help.
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: Watermarking Transparent PSD Image

Post by pssvarma8881 »

Hi Let me know if you have any suggestion on this .
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Watermarking Transparent PSD Image

Post by fmw42 »

Suggestions for what? What is the problem? Post and image and tell me what is not working.
pssvarma8881
Posts: 45
Joined: 2016-09-18T15:42:46-07:00
Authentication code: 1151

Re: Watermarking Transparent PSD Image

Post by pssvarma8881 »

User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Watermarking Transparent PSD Image

Post by fmw42 »

Please provide your input image separately and your exact IM command line.
Post Reply