I'm not aware of why we were suppressing jpeg support before, but this
sounds like a good idea to me.
David

On Thu, Nov 16, 2023 at 9:48 AM Eric Gourgoulhon <egourgoul...@gmail.com>
wrote:

> Hi All,
>
> Pillow provides the Python Imaging Library (PIL)
> https://pillow.readthedocs.io/en/stable/
> and is a standard package in Sage.
>
> Now, in Sage 10.2.rc3, the following code
>
> g = plot(sin(x))     # to generate a png figure
> g.save("fig.png")  #
> from PIL import Image
> img = Image.open("fig.png")
> img_rgb = img.convert("RGB")
> img_rgb.save("fig.jpg")
>
> returns
>
> OSError: encoder jpeg not available
>
> This is actually not surprising since the file
> SAGE_ROOT/build/pkgs/pillow/spkg-install.in
> contains the line:
>
> PILLOW_CONFIG_SETTINGS="-C debug=true -C jpeg=disable
> $PILLOW_CONFIG_SETTINGS"
>
> Is there any reason for "jpeg=disable" ?
> Providing PIL without jpeg support seems quite weird...
> This issue is not new and was already noticed already 5 years ago:
> https://ask.sagemath.org/question/43298
>
> A side effect of this is that the IPyhon  rendering of PIL Images via the
> rich output mechanism is broken in Sage 10.2.rc3 (but, for some reasons,
> not in Sage 10.1):
> in a Jupyter notebook, typing
>
> img = Image.open("fig.png")
> img
>
> does display the image but after an error message terminating by
> ValueError: Could not save to JPEG for display
> There is no such error message in Sage 10.1
>
> If we agree to restore jpeg support in Pillow, I have prepared a branch
> that does this for Sage 10.2 (simply suppressing the option "jpeg=disable"):
> https://github.com/egourgoulhon/sage/tree/pillow_jpeg
> and I am happy to submit a PR for this.
>
> Eric.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/e1a2bf34-d3e5-492b-942c-33b1fc8c3254n%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/e1a2bf34-d3e5-492b-942c-33b1fc8c3254n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAChs6_%3DqnJhUOK1ND3A7vuLgo_bTP-8kEHGEKojBWoQJQBZsKA%40mail.gmail.com.

Reply via email to