GIMP API for "Save color profile" option in file exporting

Hi,
In GIMP file export command, there is “Save color profile” option.

However I can’t find GIMP API for this option. When I try to save the image with Gimp.file_save API or file-tiff-export pdb command using Python, the image will be always saved in sRGB and Color Profile specification will be stripped.

And Gimp.ColorProfile.save_to_file API doesn’t seem for this purpose.

Is there anyone who knows the way to save the image with Color Profile using Python?

Will these help? Get colour profile and save it somewhere (disk or memory, whatever). Set colour profile = use the saved colour profile.

There are a number of other colour profile related API calls.

Hi, chuck.

Thanks. I tried already these APIs.
Actually, I can apply icc profile to the image successfully using following command.

rec2020_icc = Gio.File.new_for_path(“Rec2020-elle-V4-g10.icc”)
image.set_color_profile_from_file(rec2020_icc)

However, I try to save the image as a file using following command, the applied color profile will be stripped in the saved file.

Gimp.file_save(run_mode=Gimp.RunMode.NONINTERACTIVE, image=image,
file=Gio.File.new_for_path(“temp.tif”), options=None)

I also used file-tiff-export pdb API, but the result was same. It seems that there is no option to keep the color profile of the image in these saving command. Also it seems any ColorProfile APIs have no effect to file saving.

Hi! If you use the file-tiff-export PDB, there’s a include-color-profile parameter you can set to TRUE to include the color profile. Check the Procedure Browser in GIMP and scroll through it to see all the options.

2 Likes

Thank you very much! It works!
I missed it.