Hi,
I have a webapplication where any random image can be uploaded. I want to convert every uploaded image to sRGB.
Can someone help me with this?
Can it be done for every image? What are the steps (commandline options)?
Thanks!
How to convert any random image to sRGB ?
-
- Posts: 20
- Joined: 2011-11-16T08:53:16-07:00
- Authentication code: 8675308
Re: How to convert any random image to sRGB ?
I have never done it but try:
http://www.imagemagick.org/script/comma ... colorspace
Code: Select all
convert input -colorspace sRGB output
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to convert any random image to sRGB ?
Sorry NO.
the SRGB colorspace is miss-named in IMv6. It converts from sRGB to linear RGB.
This aspect will be fixed in a later stage of IMv7 development.
To convert a linear RGB image to sRGB you need to do this
See Gamma Correction and sRGB Colorspace
http://www.imagemagick.org/Usage/color_ ... perception
the SRGB colorspace is miss-named in IMv6. It converts from sRGB to linear RGB.
This aspect will be fixed in a later stage of IMv7 development.
To convert a linear RGB image to sRGB you need to do this
Code: Select all
convert -size 100x100 gradient: \
-set colorspace sRGB -colorspace RGB gradient_sRGB.gif
See Gamma Correction and sRGB Colorspace
http://www.imagemagick.org/Usage/color_ ... perception
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 20
- Joined: 2011-11-16T08:53:16-07:00
- Authentication code: 8675308
Re: How to convert any random image to sRGB ?
Thanks for your answers.
You are both suggesting to use the -colorspace option, but how about the -profile option then?
Don't I need to use the -profile option in combination with all kinds of profile files (like .icc), as is described in the documentation here: http://www.imagemagick.org/Usage/formats/#color_profile
I'm not quite sure what to do.
You are both suggesting to use the -colorspace option, but how about the -profile option then?
Don't I need to use the -profile option in combination with all kinds of profile files (like .icc), as is described in the documentation here: http://www.imagemagick.org/Usage/formats/#color_profile
I'm not quite sure what to do.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to convert any random image to sRGB ?
Profile is the better solution, if you can assign the original image a profile. Two profile options will convert the image, as documented in the link provided. Just remember that generally (but not always) any image read is should be assumed to be sRGB already.
The exceptions to this are mathematical or data images, greyscale masks (alpha channels are automatically thought of as linear), and image maps (for position or lighting effects). This makes reading, processing and writing images 'correctly' in IM (or any other image processor) tricky, as each image really needs to have that information specified.
The exceptions to this are mathematical or data images, greyscale masks (alpha channels are automatically thought of as linear), and image maps (for position or lighting effects). This makes reading, processing and writing images 'correctly' in IM (or any other image processor) tricky, as each image really needs to have that information specified.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/