Page 3 of 3
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-08T07:50:09-07:00
by CatBurgers
glennrp wrote:The American flag image is a grayscale JPEG. It contains at least two sRGB profiles. Grayscale images are only allowed to have grayscale ICC profiles.
There must be something I'm not understanding. Like you said, the original image has two sRGB profile that I can tell using identify:
Code: Select all
icc:description: sRGB IEC61966-2.1
...
photoshop:ICCProfile: sRGB IEC61966-2.1
However, it's not until it's been processed by imagemagick that photoshop is reporting an error when trying to open the image. If I diff the results of identify for both the original file and the one outputted by imagemagick I get
this (notable: class is changed from Directclass to PseudoClass, colorspace is changed from 2 to 1, rendering intent is changed from Perceptual to Undefined, Chromacity is removed and Colormap entries and Colormap are added).
I'm guessing that I would need to mitigate this issue by converting from sRGB to a grayscale icc profile like you said but how would I go about to do that? I can't find any grayscale ICC profile out there.
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-08T08:24:06-07:00
by snibgo
americanflag01BW.jpg has three colour channels: YCbCr.
Code: Select all
convert -verbose americanflag01BW.jpg x.jpg
x.jpg has ony one colour channel.
Code: Select all
convert -verbose americanflag01BW.jpg -type truecolor x2.jpg
x2.jpg has three colour channels: YCbCr.
As jpg files cannot contain transparency, and you always want three colour channels, "-type truecolor" seems to be the solution.
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-08T08:55:46-07:00
by CatBurgers
How would I identify the color channels? Using identify, both pre and post convert show
Code: Select all
Depth: 8-bit
Channel depth:
gray: 8-bit
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-08T09:00:10-07:00
by snibgo
"identify" tells you what the data looks like, after IM has read it in. For your purpose, you care about the data in the file. exiftool tells us this.
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-09T11:44:29-07:00
by CatBurgers
Okay, so what I'm currently using is identify to detect the Grayscale type and exiftool to detect Color Components higher than one and if both these tests are positive, I use -type TrueColor when converting. Does that make sense?
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-09T23:15:02-07:00
by snibgo
I don't use Photoshop so can't say what you need to do.
But if you want to guarantee the output has three colour channels, "-type truecolor" does the job.
I have never encountered grayscale ICC profiles.
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-09T23:22:30-07:00
by fmw42
snibgo wrote:I have never encountered grayscale ICC profiles.
I have 3 grayscale icc and icm profiles: GrayTone.icc, jasper_sGray.icm, JMARS_sGray.icc.
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-09T23:40:33-07:00
by snibgo
Ah, interesting. Can you put them somewhere accessible?
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-10T10:31:23-07:00
by fmw42
Re: Embedded ICC profile is invalid in converted JPEG
Posted: 2014-12-10T14:23:02-07:00
by fmw42
P.S. You can emulate sgray (as suggested by user Drarakel as I recall)
Code: Select all
convert image -colorspace sRGB -intensity rec709luminance \
-colorspace gray -set colorspace RGB -colorspace sRGB result
see examples at
http://www.fmwconcepts.com/imagemagick/ ... /index.php