5

JPEG XR is a Microsoft developed format.

On Ubuntu 14.04, I installed

sudo apt-get install libjxr-dev
sudo apt-get install libjxr-tools

and now I can at least convert the *.jxr files into other more friendly formats like bitmap or tif, with

JxrDecApp -i in.jxr -o output.bmp -c 0

or just using (ImageMagick)

convert in.jxr output.tif

However, Pillow still won't read the jxr image:

from PIL import Image
img =  Image.open('in.jxr', 'rb')

gives IOError: cannot identify image file 'in.jxr'.

(it has no problem with the out.tif of course).

I rebuilt Pillow (with --no-cache-dir after installing the libjxr-dev lib too by the way).

I also tried using Wand, but despite the ImageMagick convert command working, Wand won't read the file (possibly because ImageMagick just delegates this task to JxrDecApp anyway).

Finally, I tried imageio, with im = imageio.imread('my.jxr'), and it also failed to read the file.

Is there anyway I can process these JXR images in Pillow? Or any way at all in Python for that matter? I'm stuck calling convert with a subprocess at the moment..

fpghost
  • 2,834
  • 4
  • 32
  • 61
  • I don't think Pillow supports JPEG-XR. if you are using imageio, please notice that it uses the freeimage library, and a bug was carelessly introduced in the Debian/Ubuntu package that breaks support for jxr and other formats. http://git.net/ml/general/2016-10/msg21901.html – dividebyzero Jan 24 '17 at 15:52

0 Answers0