color space of image imported from JPEG

67 views
Skip to first unread message

James Walker

unread,
Mar 5, 2012, 7:09:36 PM3/5/12
to Quart...@lists.apple.com
Some JPEGs include color profile information, but some don't. If I
import a JPEG without color profile information using Image IO
(CGImageSource...), I get an image such that CGColorSpaceCopyName(
CGImageGetColorSpace( img ) ) returns the name "kCGColorSpaceDeviceRGB".
That constant seems to be undocumented, and I'm not too confident of
my understanding of color spaces, but tell me if these guesses sound right:

(1) That "device" in the color space name means that the image is likely
to look different on different machines.

(2) If I took the image and fed it to CGImageCreateCopyWithColorSpace
along with the generic RGB color space, it would do color matching to
convert to generic RGB (as opposed to pretending that the image was
generic RGB all along), and the resulting image would still be
device-dependent.
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (Quart...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/quartz-dev/quartz-dev-garchive-50095%40googlegroups.com

This email sent to quartz-dev-g...@googlegroups.com

Michael B Johnson

unread,
Mar 5, 2012, 10:27:39 PM3/5/12
to James Walker, Quart...@lists.apple.com
If there's no color profile, you (theoretically) have no idea what color space it's coming from, so you really know very little about how to map those RGB values.

In practice, I would assume an sRGB gamma 2.2 space and go from there. Your mileage may vary.

> https://lists.apple.com/mailman/options/quartz-dev/wave%40pixar.com
>
> This email sent to wa...@pixar.com

--> Michael B. Johnson, PhD
--> http://homepage.mac.com/drwave (personal)
--> http://xenia.media.mit.edu/~wave (alum)
--> MPG Lead
--> Pixar Animation Studios

David Duncan

unread,
Mar 6, 2012, 12:26:43 PM3/6/12
to James Walker, Quart...@lists.apple.com
On Mar 5, 2012, at 4:09 PM, James Walker wrote:

(2) If I took the image and fed it to CGImageCreateCopyWithColorSpace along with the generic RGB color space, it would do color matching to convert to generic RGB (as opposed to pretending that the image was generic RGB all along), and the resulting image would still be device-dependent.

CGImageCreateCopyWithColorSpace does not do color matching, it just replaces the color space of the given image. Basically its a re-interpret operation.
--
David Duncan

James Walker

unread,
Mar 6, 2012, 1:45:02 PM3/6/12
to David Duncan, Quart...@lists.apple.com

Thanks, that helps.

Reply all
Reply to author
Forward
0 new messages