Page 1 of 2
Photoshop see negative
Posted: 2019-07-15T03:55:17-07:00
by taratata
Hello
I am trying to convert a jpeg cmyk image with a clipping path to pdf with this:
Code: Select all
convert in.jpg -density 300 -alpha transparent -clip -alpha opaque +clip -trim +repage out.pdf
I have two issues:
1/ When opened in photoshop the file look negative but is correct in Acrobat
2/ Unless I use
-strip the file is too big (6.4mb) but I don't want to get rid of metadata from the in file.
Sample image here:
https://www.dropbox.com/s/m8m2wvwny1rze72/in.jpg?dl=0
CentOS Linux release 7.6.1810 (Core)
ImageMagick 7.0.8-53 Q16 x86_64 2019-07-05
Thank you for your help.
Re: Photoshop see negative
Posted: 2019-07-15T05:28:52-07:00
by snibgo
taratata wrote:1/ When opened in photoshop the file look negative but is correct in Acrobat
Running your command on your file, the result looks correct in Adobe Acrobat Reader. Is your version of Photoshop current, or ancient?
taratata wrote:2/ Unless I use -strip the file is too big (6.4mb) but I don't want to get rid of metadata from the in file.
"identify -verbose" shows that the file contains an embedded ICC profile that is 1.8 MB. You could save space by converting to a smaller ICC profile. This may change colours slightly if the profiles have different gamuts.
Re: Photoshop see negative
Posted: 2019-07-15T05:36:57-07:00
by taratata
yes Acrobat see correctly the file, but photoshop cc 2018 does not.
when I -strip the file removing any profile I get a 368k image, icc profile is only 1.8 MB what is the other data -strip remove ? -verbose does not show profiles with such amount of data. The original in.jpg file neither.
Re: Photoshop see negative
Posted: 2019-07-15T06:49:26-07:00
by snibgo
I don't use Photoshop and don't know that that problem is.
Your input file is 2087841 bytes. "identify -verbose" says:
Code: Select all
Profiles:
Profile-8bim: 9090 bytes
Profile-exif: 4848 bytes
Profile-icc: 1829044 bytes
Profile-iptc: 241 bytes
The image itself is small, and most of the file is that ICC profile.
Re: Photoshop see negative
Posted: 2019-07-15T08:28:00-07:00
by taratata
yes, I noticed that the ICC profile is most of input file. But output file is
6.3MB. If I look at identify -verbose out.pdf I get
Code: Select all
Profiles:
Profile-xmp: 11204 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 128693B
Notice ICC profile is gone and file size is very small.
With
-strip I get
Code: Select all
Properties:
date:create: 2019-07-15T15:17:54+00:00
date:modify: 2019-07-15T15:17:54+00:00
pdf:HiResBoundingBox: 114.48x282.48+0+0
pdf:Version: PDF-1.4
signature: 966f2b605c2109149d51d6d1b1914ebefa12e7dac9bf035cc4cfcab4eedd973b
Artifacts:
verbose: true
Tainted: False
Filesize: 128693B
I have the same size, no profile at all and the filesystem reports a file size of 383KB.
I do need XMP profile and may be 8BIM profile so I can't use -strip.
+profile could help me if only I know what profile to remove
I suspect the absent 8BIM profile to be responsible for the negative behaviour of Photoshop
Re: Photoshop see negative
Posted: 2019-07-15T10:04:13-07:00
by taratata
Should we move this to the Consulting forum, because I need to solve this in a short delay.
Re: Photoshop see negative
Posted: 2019-07-15T10:23:30-07:00
by fmw42
Consulting is only for PAID consulting. Are you willing to pay for a solution?
Re: Photoshop see negative
Posted: 2019-07-15T10:28:23-07:00
by fmw42
This works for me. And opens fine in PS. Your file seems to have an ISO Coated v2 (CMYK) profile.
Code: Select all
identify -quiet -format "%[8BIM:1999,2998:#1]" in.jpg |\
convert -quiet in.jpg \
-profile /Users/fred/images/profiles/sRGB.icc \
\( -density 96 - -channel rgb -negate -blur 0x1 -level 50x100% +channel \) \
-alpha off -compose copy_opacity -composite \
image.psd
Re: Photoshop see negative
Posted: 2019-07-15T11:30:52-07:00
by taratata
Of course
Re: Photoshop see negative
Posted: 2019-07-15T11:31:57-07:00
by taratata
Sorry ok to pay
Re: Photoshop see negative
Posted: 2019-07-15T12:41:17-07:00
by fmw42
Have you tried just a simple convert. That seems to open in PS just fine also and PS sees the clip path.
Note that some viewers do not respect CMYK, especially if they do not have a CMYK-type profile. If the do not respect the CMYK profile, then you will see inverted (negated) colors. It is viewer dependent.
See my other solution above, also.
My first solution will make the outside transparen. It creates an alpha channel. That may be why the file is larger in your case, also. My second solution here just copies the file and keeps the clipping path. You have to use PS to make it transparent or some other tool.
Re: Photoshop see negative
Posted: 2019-07-16T00:43:21-07:00
by taratata
Thank you for your suggestions. I am trying to replace unstable Photoshop in an Enfocus Switch workflow. I need to get a cmyk pdf trimmed to clipping path.
From my example file the result should not be greater than 1.5MB.
What do you think about this ?
Re: Photoshop see negative
Posted: 2019-07-16T09:02:25-07:00
by fmw42
PDF files are vector files. But if you start with a raster file, Imagemagick will not vectorize it. It will end up being a raster file put into a vector PDF shell. So the result will be a large file size. I do not know if it can be made as small as you want. It depends upon the bit depth 8-bit vs 24-bit vs 32-bit if transparency before it is put into the PDF vector shell. Also it depends if the file is CMYK (4 channels) or RBG (3 channels) without alpha.
Also PDF files do not have sizes in MB. They are vector files and the size depends upon how you rasterize them with some specified density.
What I would do is process to extract the clip path and use it to make the background transparent. The trim the image and flatten it against white.
So if I save the result to JPG, the file size is 202 KB.
Code: Select all
identify -quiet -format "%[8BIM:1999,2998:#1]" in.jpg |\
convert -quiet in.jpg \
-profile /Users/fred/images/profiles/sRGB.icc \
\( -density 96 - -channel rgb -negate +channel \) \
-alpha off -compose copy_opacity -composite \
-trim +repage -background white -compose over -flatten \
result.jpg
But you can save to PDF, but it won't show any file size in KB or MB.
Code: Select all
identify -quiet -format "%[8BIM:1999,2998:#1]" in.jpg |\
convert -quiet in.jpg \
-profile /Users/fred/images/profiles/sRGB.icc \
\( -density 96 - -channel rgb -negate +channel \) \
-alpha off -compose copy_opacity -composite \
-trim +repage -background white -compose over -flatten \
result.pdf
Re: Photoshop see negative
Posted: 2019-07-16T10:32:26-07:00
by taratata
could do the job, but I need cmyk.
what does identity does in your command ?
Re: Photoshop see negative
Posted: 2019-07-16T12:02:57-07:00
by fmw42
Photoshop is not smart enough.
Extract your CMYK profile
Test exporting as CMYK JPG using the input profile. This works fine in Photoshop.
Code: Select all
identify -quiet -format "%[8BIM:1999,2998:#1]" in.jpg |\
convert -quiet in.jpg \
-profile /Users/fred/images/profiles/sRGB.icc \
\( -density 96 - -channel rgb -negate +channel \) \
-alpha off -compose copy_opacity -composite \
-trim +repage -background white -compose over -flatten \
-profile ISO_Coated_v2icc \
result.jpg
Test exporting it similarly as PDF. It shows inverted colors in Photoshop.
Code: Select all
identify -quiet -format "%[8BIM:1999,2998:#1]" in.jpg |\
convert -quiet in.jpg \
-profile /Users/fred/images/profiles/sRGB.icc \
\( -density 96 - -channel rgb -negate +channel \) \
-alpha off -compose copy_opacity -composite \
-trim +repage -background white -compose over -flatten \
-profile ISO_Coated_v2icc \
result.pdf
So although I can open the PDF fine in other tools such as Mac Preview, Photoshop still sees it with inverted colors. I am not expert enough with Photoshop to know if there is some color management parameter that you can set to properly open it. Look at the defaults in the PS Color Management window.