Convert Images to Display P3 Colorspace

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?".
Locked
aamir4774@gmail.com
Posts: 20
Joined: 2019-03-05T22:47:03-07:00
Authentication code: 1152

Convert Images to Display P3 Colorspace

Post by aamir4774@gmail.com »

Hi ImageMagick Community,

I need to convert jpg file to png with certain dpi and colorspace either sRGB or Display P3. Using the below command I'm able to convert the image to png sRGB colorspace. What will be the equivalent attribute to make the conversion in Display P3 colorspace?

Code: Select all

magick <input_file.jpg> -density 72 -resize 1920x1080 -colorspace sRGB -flatten -strip <output_file.png>
Thanks.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert Images to Display P3 Colorspace

Post by snibgo »

First, get an ICC profile file for each of sRGB and P3. Your IM installation directory probably contains sRGB.icc. http://color.support/iccprofiles.html has P3 profiles. I suggest you use the D65 one.

Assuming your input is encoded as sRGB, simply assign the sRGB profile and convert to the new profile:

Code: Select all

magick in.jpg -resize 1920x1080 -profile aRGB.icc -profile P3D65.icc out.jpg
Don't use "-strip". Your "-flatten" does nothing.

(Edited for typo.)
snibgo's IM pages: im.snibgo.com

Locked