First of all: thank you very much for your response, I really appreciate your effort and time to help me!
fmw42 wrote:If you input is CMYK, then try
Code: Select all
-set colorspace CMYK -colorspace RGB -resize '5120x3200>' -colorspace sRGB -set colorspace RGB
No, can't do that.
I do not have the option of chosing the parameters at runtime.
The software I use do not let me and it should work with any Image.
The Image can be a PNG or JPG with any color profile. It should come in and exit resized in RGB/sRGB with the same parameters.
This just used to work until before the upgrade. And this is why the colorspace option has been broken.
You can't expect me to check every image and see what they are and, in respect to that define the options to resize.
If that was suitable I wouldn't use ImageMagick at all, I'd just fire up Gimp and do it from there.
fmw42 wrote:But I suspect you have been doing it oddly for a long time. It looks like you want a doubly converted linear RGB image.
No, I wasn't doing anything odly.
This is what I was doing before the upgrade:
Code: Select all
-quality 90 -intent Perceptual -resize '5120x3200>' -filter Catrom -colorspace RGB -strip
Did it output RGB or sRGB? I don't know, I don't actually care for the sake of the result, it just worked.
And for "just worked" I mean that it correctly guessed which color profile to parse and always produced the same color profile as output with same visual appearance, regardless of the original image profile.
After the upgrade that seems not to be the case anymore and you actually have to know what's the original profile in order to resize the image to RGB/sRGB with the same visual appearance as the original one.
fmw42 wrote:If you want a normal sRGB image then
convert image -colorspace sRGB -resize '5120x3200> result
If you want a linear RGB image and the output format supports it, then
convert image -colorspace RGB -resize '5120x3200> -set colorspace RGB result
If you want a linear RGB but labelled as sRGB, then
convert image -colorspace RGB -resize '5120x3200> -set colorspace sRGB result
I want what the command was doing before the upgrade.
Was it a normal sRGB? A linear RGB? a linear RGB labeled sRGB? I don't know what it was.
But those command you suggested simply doesn't work for all the cases.
My test case is this:
- CMYK JPEG
- Grey JPEG
- sRGB JPEG (don't know if linear, normal or what, sRGB is what identify -verbose say in Colorspace)
- sRGB with Adobe profile
Before the upgrade the same very command produced a JPEG in RGB (sRGB.. whatever) visually equal to the original one (with the exception of the Adobe profile which was slightly different after conversion)
After the upgrade I end up with a much darker image for the sRGB (Adobe or not) images.
Changing the option from -colorspace RGB to -colorspace sRGB reverse the issue: it gives a correct image for sRGB images and produce a much lighter image for CMYK images.
What's happening under the cover? I don't know I'm no expert in colorspaces. I'm just pointing out that before it worked, now it doesn't: and I'm asking for a way to obtain the exact same result with a SINGLE command (I know how to obtain it with different command for different original color profile, but that's not what I need), is this even possible anymore?
PS: I said "I don't care if it is RGB or sRGB or RGB marked as sRGB", what I meant is that I do not care for the sake of the result: as long as it obtain a *RGB that has the same visual appearance of the original image I'm fine with it. I actually care and am interested to know what was/is going on to better understand the issue.
PPS: some context may be in order; I'm a developer and I use ImageMagick in a customization of a third party open source software that, among other features, provide a manner to automatically resize images using ImageMagick. The customer upload Images to the software, gets a bunch of resizes on different sizes which are then shipped to different platforms (web, Android, iOS, ...). Android do not support color profiles in Images and do not support CMYK, which means I have to resize the images and convert them to RGB/sRGB. I do the same for all the platforms involved for consistency and because some color profile may not be supported in iOS or future platform as well while RGB should always be supported. After an operating system software update the customer started to complain images was randomly becoming very darker. The reason is this change in ImageMagick and I need to find a way to make the software work as used to work with the new ImageMagick.