python-pillow / python-pillow/Pillow

Support for partial decoding of JPEG 2000 and pyramid TIFs

Open
#4,111 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Python
Stars
13.8k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
89

Description

Hi!

I'm using PIL to serve images using the IIIF protocol and have a performance question. Has there been any work done, or interest shown, in partial decoding of JPEG2000-images (and multi-resolution TIFs)?

There are two things that speed up the decompression of an image a lot when using opj_decompress: (1) reducing the size and quality layers and (2) cropping.

This is useful when creating tiles and/or thumbnails on the fly from large image collections, i.e when you don't want to create and save a huge number of pre-scaled/cropped tiles and sizes. As far as I can tell you can set Jpeg2KImageFile.reduce and .layers to decrease the final size which will result in faster decode time, but there is no way to decode only the cropped region. Am I correct, or is there any way to tell PIL to tell OpenJPEG to do partial decoding?

Best regards,
Martin

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Jpeg2KImageFile handling of reduce and layers, then compare it with the cropping options exposed by OpenJPEG's opj_decompress. The work is complete when Pillow can request cropped-region decoding for JPEG 2000 images and address the corresponding partial-decoding behavior for multi-resolution TIFFs.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.