Watermarked PSD does not work in our software

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?".
Post Reply
Cable35
Posts: 5
Joined: 2018-12-05T09:45:42-07:00
Authentication code: 1152

Watermarked PSD does not work in our software

Post by Cable35 » 2018-12-05T09:55:56-07:00

Version: ImageMagick 6.7.8-9 2016-06-16 Q16 http://www.imagemagick.org

We use some website software to share files with people. The website software is able to generate a preview of a Photoshop PSD file and it works well with them.

I found a watermarking script on this message board and when i use it on some PSD files the generated files do now process in our website software. Other PSD files work fine with the below script.

Script:

Code: Select all

# get dimensions of incoming file and save as a variable
dim=`convert "$1"[0] -format "%wx%h" info:`

#echo $dim
#echo $1 #incoming file
#echo $2 #outgoing file

convert \( "$1"[0] -background white -flatten \) \
\( -clone 0 -fill "gray(10%)" -colorize 50 \) \
\( /home/user/scripts/watermark.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite \
"$2"
Here is how i use the above script:

Code: Select all

./watermark.sh "/home/user/scripts/test03.psd" "/data/Test/test03.psd"
Here is a zip file containing the original PSD and the PSD that ImageMagick made.
https://www.dropbox.com/s/01cxa7b1dntca ... K.zip?dl=0

Does anyone see a problem with my script or a problem with the original PSD that ImageMagick may have problems with?

Thanks!

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

Re: Watermarked PSD does not work in our software

Post by fmw42 » 2018-12-05T11:21:08-07:00

Post your watermark image so we can test with it. Note that your IM version is 6/16/2016, so two years old. You should see if there is a more recent patch. Your PSD file is CMYK and ImageMagick works best when both images are RGB. So try converting your PSD to sRGB using -colorspace sRGB right after reading it in.

Cable35
Posts: 5
Joined: 2018-12-05T09:45:42-07:00
Authentication code: 1152

Re: Watermarked PSD does not work in our software

Post by Cable35 » 2018-12-05T12:28:40-07:00

I will see if i can update to a more recent version and start there.

I don't know if i will be allowed to convert to RGB. I would have to convert the watermarked image back to CMYK for sure.

Here is my watermark png image.
https://www.dropbox.com/s/h9alumw198zep ... k.png?dl=0

Thanks for the reply!

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

Re: Watermarked PSD does not work in our software

Post by fmw42 » 2018-12-05T12:46:43-07:00

Your watermark image is already sRGB. I see no reason to have to convert the result back to CMYK. But you can if you want. The best way would be to use profiles. Otherwise at the end add -colorspace CMYK if you have converted your input PSD to sRGB. Also converting from CMYK to sRGB would be best done with profiles; otherwise use -colorspace sRGB.

I will test your command later today and get back to you.

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

Re: Watermarked PSD does not work in our software

Post by fmw42 » 2018-12-05T16:45:23-07:00

What was wrong with your ImageMagick result?

When I process the following on my Mac OSX Sierra with IM 6.0.10.15 Q16, I get the following:

Code: Select all

dim=`convert 20064730_ORINGINAL.psd[0] -format "%wx%h" info:`
convert \( 20064730_ORINGINAL.psd[0] -background white -flatten \) \
\( -clone 0 -fill "gray(10%)" -colorize 50 \) \
\( watermark.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite \
20064730_ORINGINAL_fred1.psd
http://www.fmwconcepts.com/misc_tests/w ... _fred1.psd


When I convert the input to sRGB, I get

Code: Select all

dim=`convert 20064730_ORINGINAL.psd[0] -format "%wx%h" info:`
convert \( 20064730_ORINGINAL.psd[0] -colorspace sRGB -background white -flatten \) \
\( -clone 0 -fill "gray(10%)" -colorize 50 \) \
\( watermark.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite \
20064730_ORINGINAL_fred2.psd
http://www.fmwconcepts.com/misc_tests/w ... _fred2.psd


When I convert the input to sRGB and the output to CMYK, I get:

Code: Select all

dim=`convert 20064730_ORINGINAL.psd[0] -format "%wx%h" info:`
convert \( 20064730_ORINGINAL.psd[0] -colorspace sRGB -background white -flatten \) \
\( -clone 0 -fill "gray(10%)" -colorize 50 \) \
\( watermark.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite -colorspace CMYK \
20064730_ORINGINAL_fred3.psd
http://www.fmwconcepts.com/misc_tests/w ... _fred3.psd

Cable35
Posts: 5
Joined: 2018-12-05T09:45:42-07:00
Authentication code: 1152

Re: Watermarked PSD does not work in our software

Post by Cable35 » 2018-12-06T07:10:56-07:00

I took your test result images and loaded them into our web application and they worked fine.
https://www.screencast.com/t/KGSHuEA2b5

So i need to figure out how to update my installation of ImageMagick. This is a CentOS computer.

I am not the best at linux, but is there a reason when i used yum to install ImageMagick it installed such an old version?

Thanks for all the help!

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

Re: Watermarked PSD does not work in our software

Post by fmw42 » 2018-12-06T14:44:50-07:00

I do not know Linux installs. But the patch date is more important than the version number. Check with the CentOS people about a more current patch or install the binary from https://imagemagick.org/script/download.php for IM 7 or https://legacy.imagemagick.org/script/download.php for IM 6

Post Reply