core
core copied to clipboard
image format support
IMO we currently have an unfortunate situation regarding support for modern image formats:
(In the following, I will refer to Ubuntu 18, because it is our default target for Travis/CircleCI and Docker.)
- JBIG2 (for bitonal images, lossless or lossy) is supported by Graphics/ImageMagick in Ubuntu 18 (and thus, ocrd_im6convert and ocrd_olena etc) but not by Pillow (and there is not even a mention of it in issues/pulls) – we don't have it in core under supported MIME types yet
- JPEG2000 (for RGB/grayscale images, lossless or lossy with graceful degradation) is not supported by Graphics/ImageMagick in Ubuntu 18 but by Pillow – wo do have it in core under supported MIME types already
Now, in recent Ubuntu versions such as 20.10, IM finally got JP2 support out of the box by upgrading its required libopenjp2 to main.
So, should we try to find and recommend backport PPAs for JP2? The alternative, in consequence, should be removing support in OCR-D for now (so files must be converted by external means before import).
And what about JB2 in Python? There seem to be encoder/decoder libraries with Python bindings, but supporting this transparently is out of the question without PIL, right?
The bigger question here is: do image formats "supported" by core (in the sense that it knwos their MIME type and extension, and thus imports them and hands them to processors) have to be supported in all backends / processors? Or are we okay with partial support, so overall success depends on the workflow and individual files (e.g. wait for ocrd-olena-binarize to deal with .jp2 and then continue with .png normally, or wait for ocrd-skimage-normalize to deal with .jb2 and then continue with .png normally)?