Skip to content

Trying to save a (0, 0) image creates an unreadable file #5944

@NewUserHa

Description

@NewUserHa

What did you do?

from PIL import Image
Image.new("RGB",(0,0)).save('test.png') # `.png` or `.jpg` or `.tiff`

What did you expect to happen?

no file should be created on disk because there's an SystemError: tile cannot extend outside image error.
(#5931 (comment) for jpg, libjpeg seems not support size 0 0)

What actually happened?

throw SystemError: tile cannot extend outside image
a ~33 bytes file is on disk, which is unable to read via pillow and other viewer No matter the extension is .png or .jpg or .tiff

What are your OS, Python and Pillow versions?

  • OS: win10 1803
  • Python: 3.8.10
  • Pillow: 9.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions