Need help with resizing AdobeRGB images for web

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
rain
Posts: 5
Joined: 2015-11-01T04:40:21-07:00
Authentication code: 1151

Need help with resizing AdobeRGB images for web

Post by rain »

Hi

I am trying to resize my photos to display on my web site. I get Adobe RGB from my camera. But some web browsers does not support it. Therefore I want to convert them to sRGB. Now my question is that how do I do that and keep colors at the same time?

My current code is:

Code: Select all

convert in.jpg -resize 1365x2048 -quality 90 -set colorspace sRGB out.jpg
But that ruins my colors. Green goes to yellowish.
Here's sample:

Image

Left is the way it should be (greener) right is what I get with -set colorspace sRGB.

And one more question that I have. I currently use -resize 1365x2048. Can I tell it instead that longest side should be 2048 so that it would automatically figure out that the other side should be 1365?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Need help with resizing AdobeRGB images for web

Post by glennrp »

Regarding your second question, you can use "-resize 2048" or "-resize 2048x2048"
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Need help with resizing AdobeRGB images for web

Post by glennrp »

Regarding the first question, would you post a link to in.jpg? Also please tell us your ImageMagick version.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Need help with resizing AdobeRGB images for web

Post by snibgo »

The photos from the camera probably have an embedded AdobeRGB profile. Use "-profile sRGB.icc" to convert the image to sRGB. You can also use an "-intent" setting if you want.

Ideally, don't start from a jpeg.
snibgo's IM pages: im.snibgo.com
rain
Posts: 5
Joined: 2015-11-01T04:40:21-07:00
Authentication code: 1151

Re: Need help with resizing AdobeRGB images for web

Post by rain »

snibgo wrote:The photos from the camera probably have an embedded AdobeRGB profile. Use "-profile sRGB.icc" to convert the image to sRGB. You can also use an "-intent" setting if you want.

Ideally, don't start from a jpeg.
How do I exactly do that?

Code: Select all

convert in.jpg -resize 300x225 -quality 90 -profile sRGB.icc  out.jpg
But

Code: Select all

 identify -verbose out.jpg 
still shows

Code: Select all

    icc:description: Adobe RGB (1998)
    icc:manufacturer: Adobe RGB (1998)
    icc:model: Adobe RGB (1998)
What -intent exactly does?

would you post a link to in.jpg?
I wont have access to this image till next weekend, but here is another one that behaves the same way:
http://regex.info/i/cs/Momiji-AdobeRGB-yes.jpg
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Need help with resizing AdobeRGB images for web

Post by snibgo »

Code: Select all

convert -verbose Momiji-AdobeRGB-yes.jpg -profile sRGB.icc x.jpg
"identify" shows x.jpg has the sRG profile, instead of AdobeRGB. sRGB.icc is in my current directory. If it wasn't, I would provide the full path to it.

For "-intent", see http://www.imagemagick.org/script/comma ... php#intent
snibgo's IM pages: im.snibgo.com
rain
Posts: 5
Joined: 2015-11-01T04:40:21-07:00
Authentication code: 1151

Re: Need help with resizing AdobeRGB images for web

Post by rain »

But did you try "identify -verbose" ? it still shows it is Adobe RGB. Also when you open it with gimp it tells you that it Adobe RGB and asks you if you want to convert this.

An other notice I made is that when you remove "-verbose" from "identify" then it also thinks that the original file is sRGB (Momiji-AdobeRGB-yes.jpg)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need help with resizing AdobeRGB images for web

Post by fmw42 »

Works fine for me on IM 6.9.2.5 Q16 Mac OSX

Code: Select all

  identify -verbose Momiji-AdobeRGB-yes.jpg
Properties:
    date:create: 2015-11-01T11:38:29-08:00
    date:modify: 2006-09-17T02:10:46-07:00
    icc:copyright: Copyright 1999 Adobe Systems Incorporated
    icc:description: Adobe RGB (1998)
    icc:manufacturer: Adobe RGB (1998)
    icc:model: Adobe RGB (1998)
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 60fe692041631c128b7a51ebb3d63fcc79f3717b4cbf4b574b97f36b5d34c707

Code: Select all

convert Momiji-AdobeRGB-yes.jpg -profile /Users/fred/images/profiles/sRGB.icc x.jpg
identify -verbose x.jpg
 Properties:
    date:create: 2015-11-01T11:41:40-08:00
    date:modify: 2015-11-01T11:41:40-08:00
    icc:copyright: sRGB built-in
    icc:description: sRGB built-in
    icc:manufacturer: (lcms internal)
    icc:model: sRGB built-in
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 5512ae183d209066618cd14092102ae971f2732906341ee1326039d8400ed2b0
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Need help with resizing AdobeRGB images for web

Post by snibgo »

What version IM are you using? What platform? On v6.9.1-6, Windows 8.1, it converts fine.
snibgo's IM pages: im.snibgo.com
rain
Posts: 5
Joined: 2015-11-01T04:40:21-07:00
Authentication code: 1151

Re: Need help with resizing AdobeRGB images for web

Post by rain »

LinuxVersion: ImageMagick 6.6.0-4 2015-05-28 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

Debian 6.0.7 "squeeze"
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need help with resizing AdobeRGB images for web

Post by fmw42 »

Your version is about 320 versions old. You might consider upgrading.
rain
Posts: 5
Joined: 2015-11-01T04:40:21-07:00
Authentication code: 1151

Re: Need help with resizing AdobeRGB images for web

Post by rain »

I cant upgrade it. It's on my web hosting company.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Need help with resizing AdobeRGB images for web

Post by Bonzo »

They should upgrade it for you and if not I would change companies. There are plenty of choices around these days.

Alternatively you can install Imagemagick on your computer. I have it installed and have written a batch file where I drop the image over the icon and it carries out my conversions for me.
Post Reply