Skip to content

JPEG 2000 file cannot be Image.reduce() 'd #4343

Closed

Description

@Eximius

JPEG 2000 file cannot be Image.reduce() 'd

... because img.reduce becomes a integer 0 during loading somehow.

Can be repeated with

this image

$ python -c 'import PIL;from PIL import Image; im = Image.open("pillow_bug.jp2"); print(PIL.__version__);print(im.reduce)'
7.1.0.dev0
0

Activity

  1. added
    BugAny unexpected behavior, until confirmed feature.
    on Jan 8, 2020
  2. radarhere commented on Jan 8, 2020

    @radarhere
    Member

    Hi. Thanks for reporting this. The bug you've found applies to Jpeg2000 images. #4251 added an Image reduce method which is here overlapping with Jpeg2KImagePlugin's reduce property. I've created PR #4344 to resolve the situation.

    In the meantime, you can workaround this by simply copying the image first -

    from PIL import Image
    im = Image.open("pillow_bug.jp2")
    im.copy().reduce(2)
  3. homm commented on Jan 8, 2020

    @homm
    Member

    Unfortunately, this breaks a very common use case:

    Image.open("pillow_bug.jp2").thumbnail((100, 100))

    because thumbnail now uses .reduce() method internal.

  4. added this to the 7.1.0 milestone on Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.JPEG

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions