Converting HEIC images with Display P3 color profile
Converting HEIC images with Display P3 color profile
I am trying to convert HEIC images shot with the lastest generation of iPhones. They are in HEIC format and use the "Display P3" color profile. When I try to convert the images to JPGs the colors get washed out. The profile in the picture is an exif-profile, not an ICC profile. I assume 'convert' does not recognise this kind of profile. Is there a way to tell 'convert' to use an external icc-profile (I have a "Display P3" icc file extracted from a JPEG) and use that to interpret the image data while converting to JPGs?
I'm using the latest version of ImageMagick compiled from source on a CentOS server.
Thanks for any help.
I'm using the latest version of ImageMagick compiled from source on a CentOS server.
Thanks for any help.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting HEIC images with Display P3 color profile
If the input has a profile (icc, icm), then add one -profile for the output color type.
If the input has no profile (icc, icm), then add two profiles, one for what the input color type is and one for what you want for the output
see http://www.imagemagick.org/script/comma ... hp#profile
Code: Select all
convert input -profile path/to/profile.icc output
Code: Select all
convert input -profile path/to/profile1.icc -profile path/to/profile2.icc output
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting HEIC images with Display P3 color profile
As Fred says. ICC profiles for P3 are available from http://color.support/iccprofiles.html
snibgo's IM pages: im.snibgo.com
Re: Converting HEIC images with Display P3 color profile
I tried to do thatfmw42 wrote: ↑2018-06-29T12:42:19-07:00 If the input has no profile (icc, icm), then add two profiles, one for what the input color type is and one for what you want for the output
Code: Select all
convert input -profile path/to/profile1.icc -profile path/to/profile2.icc output
Code: Select all
convert IMG_8938.HEIC -profile Display\ P3.icc -profile sRGB2014.icc IMG_8938_srgb.jpg
I have put the images on our server, maybe it helps if you can see the images:
http://test.olloworld.com/assets/image/ ... _8938.HEIC (original Image)
http://test.olloworld.com/assets/image/ ... G_8938.JPG (JPG sRGB created with Preview on the Mac)
http://test.olloworld.com/assets/image/ ... 938_IM.jpg (JPG from ImageMagick without profiles)
http://test.olloworld.com/assets/image/ ... 8_srgb.jpg (JPG from Image Magick with profiles)
Do I have to specify a different input color space?
Any other ideas?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting HEIC images with Display P3 color profile
Put double quotes around your path to the icc file. Imagemagick thinks you have two words due the space.
convert IMG_8938.HEIC -profile "Display\ P3.icc" -profile sRGB2014.icc IMG_8938_srgb.jpg
convert IMG_8938.HEIC -profile "Display\ P3.icc" -profile sRGB2014.icc IMG_8938_srgb.jpg
Re: Converting HEIC images with Display P3 color profile
The space was escaped with the backslash.'I tried with quotes, same effect. Convert found the file, but applied in a way that gave the wrong colors.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting HEIC images with Display P3 color profile
Sorry, I do not have installed the HEIC delegate, so I cannot check for you. You will need one of the developers to check this for you.
Re: Converting HEIC images with Display P3 color profile
exactly same problem for me here
Re: Converting HEIC images with Display P3 color profile
I have the opposite problem. I have JPEGs I wish to convert to HEIC. I've tried various specifications of colorspace and profile but always seem to get the same result.
An image with lots of bright colours gets blown out. Average images seem to get more contrasty. The macOS Preview App can do the conversion without this issue and I cannot see anything in the "identify" output to distinguish the magick'ed one from the Preview one.
Any thoughts on how to get the colour conversion correct?
An image with lots of bright colours gets blown out. Average images seem to get more contrasty. The macOS Preview App can do the conversion without this issue and I cannot see anything in the "identify" output to distinguish the magick'ed one from the Preview one.
Any thoughts on how to get the colour conversion correct?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting HEIC images with Display P3 color profile
What is your ImageMagick version and platform? What was your exact command line? Can you provide your input image?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting HEIC images with Display P3 color profile
@zkarj: Can your version of IM write HEIC files?
This version (v7.0.8-64 on Windows 8.1) can read HEIC, but not write it.
Code: Select all
f:\web\im>%IMG7%magick -list format |grep -i HEIC
HEIC* HEIC r-- High Efficiency Image Format (1.4.0)
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting HEIC images with Display P3 color profile
The page at https://imagemagick.org/script/formats.php, says
convert -list format
and look at the line for HEIC assuming you have installed the needed delegate library, libheif.
So ImageMagick can only read HEIC as far as I know. Check on your system usingHEIC R Apple High efficiency Image Format HEIC requires the libheif delegate library.
convert -list format
and look at the line for HEIC assuming you have installed the needed delegate library, libheif.
Re: Converting HEIC images with Display P3 color profile
Yes, it can.
HEIC* HEIC rw- High Efficiency Image Format
I can happily read and write HEIC files and they are recognisable as the same image but the colour space handling is the problem. If I convert JPG -> HEIC then the colour is essentially an "adjusted" version of the original (blue is still blue, etc, but different hue and brightness). If I convert HEIC -> JPG then everything looks identical.
But, I tried to use the montage command on some HEICs I created with another tool and the thumbs come out with a wild pinkish-red colour cast regardless of whether the output is HEIC or JPG. It seems like this is doable, I just cannot figure out how.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting HEIC images with Display P3 color profile
In theory, this should work when the input image is sRGB with or without an embedded profile:
But I have no way of testing this.
Code: Select all
magick in.png -profile sRGB.icc P3D5.icc out.heic
snibgo's IM pages: im.snibgo.com
Re: Converting HEIC images with Display P3 color profile
Theory is a fine thing, but when I ran the following (which I think is what you meant?) the same problem occurred.
The key changes are specifying the -profile flag once for each profile (that's what the documentation says to do) and the slightly different profile names that are the ones I managed to find and download.
Code: Select all
magick in.jpg -profile sRGB2014.icc -profile P3D65.icc out.heic