Possible enhancement to how colorspace is handled within IM

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Possible enhancement to how colorspace is handled within IM

Post by fmw42 »

Hello,

When I do the following on an RGB image:

convert image.png -colorspace HSL image_hsl.png (or with suffix .jpg, etc)

and then do

convert image_hsl.png -verbose info:

The colorspace is reported as RGB and not HSL.

I was wondering if it would be feasible to have IM store the correct colorspace in the image metadata that you use for IM generated images so that one could get access to the correct colorspace for the image. This would be very useful at least for me when doing some of my IM scripting.

Thanks for your condideration

Fred Weinhaus
fmw@alink.net
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible enhancement to how colorspace is handled within IM

Post by magick »

The PNG standard does not permit colorspaces other than RGB/sRGB. If you can prove otherwise let us know.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible enhancement to how colorspace is handled within IM

Post by fmw42 »

The issue is not whether png or jpg or any other format can support other colorspaces. The issue is that IM can or should be able to record this information internally when it creates an image in some other colorspace and that information should be available for other IM processes to access. Whether or not it can be stored for export to other systems is a totally other matter.

Thanks.

Fred Weinhaus
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible enhancement to how colorspace is handled within IM

Post by magick »

The PNG folks (Glenn) has responded that they can arrange for a new chunk to specify a colorspace. Once the format of the chunk is defined and it is part of the libPNG distribution we will enhance the ImageMagick PNG coder to save/fetch the colorspace chunk.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible enhancement to how colorspace is handled within IM

Post by fmw42 »

What about JPEG as well?

And is it a requirement that this be image format dependent and not just an internal IM notation in its meta data?

Thanks in any case no matter what you decide.

Fred Weinhaus
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible enhancement to how colorspace is handled within IM

Post by magick »

JPEG supports RGB, Grayscale, and CMYK. If we store the colorspace metadata, where would we store it? Would any other software recognize the colorspace attribute or just ImageMagick?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible enhancement to how colorspace is handled within IM

Post by fmw42 »

My point is that IM should be able to handle it internally for its own scripting and proper reporting of the colorspace in -verbose info: If any other external image formats can support it, that is even better (a plus), but not a requirement.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible enhancement to how colorspace is handled within IM

Post by magick »

We recommend you use MIFF as an intermediate format. It supports *all* ImageMagick colorspaces, profiles and properties.
Post Reply