I wouldn’t use -set colorspace RGB
.
@Soupy: first, try the following command:
identify -verbose yourfile.tiff
Near the bottom of the text output, look for something like this:
Profiles:
Profile-icc: 476 bytes
Properties:
comment:
date:create: 2020-01-17T02:31:02+00:00
date:modify: 2020-01-17T03:33:42+00:00
date:timestamp: 2022-07-21T13:53:11+00:00
exif:ExposureTime: 0.001562
exif:FNumber: 8.000000
exif:FocalLength: 105.000000
exif:ISOSpeedRatings: 200
icc:copyright: auto-generated by dcraw
icc:description: XYZ
The first two lines tell us the file has an embedded profile. “icc:description” tells us the colorspace, in this case XYZ. For you it would say “REC2020” or similar.
When an image file has an embedded profile, you can convert to a new profile with “-profile NewName.icc”. This will change pixel values and embed the new profile.
convert yourfile.tiff -profile newname.icc out.tiff
Provide the full path to the ICC file if it isn’t in your current directory. IM comes with sRGB.icc. You can also use any of Elle’s profiles at elles_icc_profiles/profiles at master · ellelstone/elles_icc_profiles · GitHub
If, for some reason, there is no embedded profile, then you need to assign one. “-profile” will also do that. A second “-profile” will convert to a new profile.
EDIT:
(I want the downsizing to take place in linear space)
Convert to linear REC2020, then do the resizing, then convert to whatever profile you want. For example, assuming a profile is already embedded:
convert yourfile.tiff -profile Rec2020-elle-V2-g10.icc -filter Sinc -resize 1600 -profile sRGB-elle-V2-srgbtrc.icc quality 95 out.jpg
Incidentally, IM v7 has been out for a few years now. I suggest you upgrade.