When writing a GIMP Plugin using Python, how can the Plugin determine and/or set the Colour Profile of any image that it operates on?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

When writing a GIMP Plugin using Python, how can the Plugin determine and/or set the Colour Profile of any image that it operates on?

Developers mailing list
Hello.

I am writing a GIMP Plugin using Python, and I would like to know how my
Plugin can determine and/or set the Colour Profile of any image that it
operates on.

The reason I ask this, is because I have some PNG files which have been
generated from a PDF file by the ImageMagick convert utility. If I didn't
know better, I would say that this ImageMagick utility is embedding the
following Colour Profile into the images which it generates and stores in
the resulting PNG files;

    Artifex Software sRGB ICC Profile

I also have some PNG files which have been generated by the gnuplot
utility. The images in these files have the following Colour Profile
embedded within them;

    sRGB

When I copy and paste a gnuplot generated image into one of the other
images, the colours of the plots in the gnuplot generated image get altered
upon pasting. If I didn't know better, I'd say this is due to the
difference in the Colour Profiles, because if I load the PDF file straight
into GIMP and then inspect it - it has the sRGB Colour Profile. Then, when
I copy and paste the same gnuplot generated image into it, the colours of
the plots are correct!

I don't know a great deal about this subject material, so please excuse me
if I have asked something silly. I hope I have explained this clearly and
have provided sufficient information. Any assistance on this matter would
be greatly appreciated.

Thanks in advance and have a great day.
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: When writing a GIMP Plugin using Python, how can the Plugin determine and/or set the Colour Profile of any image that it operates on?

Ofnuts-2
On 5/21/19 3:43 AM, Craig Sanders via gimp-developer-list wrote:

> Hello.
>
> I am writing a GIMP Plugin using Python, and I would like to know how my
> Plugin can determine and/or set the Colour Profile of any image that it
> operates on.
>
> The reason I ask this, is because I have some PNG files which have been
> generated from a PDF file by the ImageMagick convert utility. If I didn't
> know better, I would say that this ImageMagick utility is embedding the
> following Colour Profile into the images which it generates and stores in
> the resulting PNG files;
>
>      Artifex Software sRGB ICC Profile
>
> I also have some PNG files which have been generated by the gnuplot
> utility. The images in these files have the following Colour Profile
> embedded within them;
>
>      sRGB
>
> When I copy and paste a gnuplot generated image into one of the other
> images, the colours of the plots in the gnuplot generated image get altered
> upon pasting. If I didn't know better, I'd say this is due to the
> difference in the Colour Profiles, because if I load the PDF file straight
> into GIMP and then inspect it - it has the sRGB Colour Profile. Then, when
> I copy and paste the same gnuplot generated image into it, the colours of
> the plots are correct!
>
> I don't know a great deal about this subject material, so please excuse me
> if I have asked something silly. I hope I have explained this clearly and
> have provided sufficient information. Any assistance on this matter would
> be greatly appreciated.

Another explanation is that the target PNG is color-indexed (if which
case whatever you paste in it has its colors coerced into those of the
colormap of the target).

Otherwise plenty of API to handle color profiles, in the Python console
(Filters>Python-fu>Console) hit "Browse...", then enter "profile" in the
search bar. If you use 2.10, best use the gimp_image* calls, the
plug-in-icc* seems to be carried over from previous versions for
compatibility.

_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list
Reply | Threaded
Open this post in threaded view
|

Re: When writing a GIMP Plugin using Python, how can the Plugin determine and/or set the Colour Profile of any image that it operates on?

Developers mailing list
In reply to this post by Developers mailing list
Hello.

After asking my question, I found the following procedures;

    plug-in-icc-profile-info

    and

    plug-in-icc-profile-set

While searching through GIMPs Procedure Browser earlier, I didn't see these
two procedures because I was searching for the keyword "space", i.e. Colour
Space, instead of "profile", i.e. Colour Profile. I blame this on my
playing around with ImageMagick too much before posting my question. The
ImageMagick convert utility uses the command line argument;

    -colorspace

and I think this term was just stuck in my head!

Sorry about that :(

On Tue, May 21, 2019 at 11:43 AM Craig Sanders <[hidden email]>
wrote:

> Hello.
>
> I am writing a GIMP Plugin using Python, and I would like to know how my
> Plugin can determine and/or set the Colour Profile of any image that it
> operates on.
>
> The reason I ask this, is because I have some PNG files which have been
> generated from a PDF file by the ImageMagick convert utility. If I didn't
> know better, I would say that this ImageMagick utility is embedding the
> following Colour Profile into the images which it generates and stores in
> the resulting PNG files;
>
>     Artifex Software sRGB ICC Profile
>
> I also have some PNG files which have been generated by the gnuplot
> utility. The images in these files have the following Colour Profile
> embedded within them;
>
>     sRGB
>
> When I copy and paste a gnuplot generated image into one of the other
> images, the colours of the plots in the gnuplot generated image get altered
> upon pasting. If I didn't know better, I'd say this is due to the
> difference in the Colour Profiles, because if I load the PDF file straight
> into GIMP and then inspect it - it has the sRGB Colour Profile. Then, when
> I copy and paste the same gnuplot generated image into it, the colours of
> the plots are correct!
>
> I don't know a great deal about this subject material, so please excuse me
> if I have asked something silly. I hope I have explained this clearly and
> have provided sufficient information. Any assistance on this matter would
> be greatly appreciated.
>
> Thanks in advance and have a great day.
>
>
_______________________________________________
gimp-developer-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list