You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to use Pillow to composite very large gigapixel image files, then save them in the PSB format using psd-tools.
When the image I save to psb is less than 30,000 pixels wide, I have no issues. As soon as my image is greater than 30,000 pixels, however, the psb file saved will not open in Photoshop, which gives me a "Could not complete your request because the file is not compatible with this version of Photoshop" error message.
According to this site, the difference between the psd and psb formats is that psd's support up to 30,000 pixel wide images, whereas psb's support up to 300,000 pixel wide images. This leads me to believe that there is a bug wherein psd-tools can only save psb images that fall under the psd size limit of 30,000 pixels.
To Reproduce
Steps to reproduce the behavior:
fromPILimportImagefrompsd_toolsimportPSDImageimportrequests# grab a png from the web to tile into a large image fileimageURL="https://linkscafeu.files.wordpress.com/2015/06/super-mario-bros-png.png"imageFile=requests.get(imageURL)
open('mario.png', 'wb').write(imageFile.content)
# open the image using Pillow and extract dimensionstileImage=Image.open('mario.png')
size=tileImage.sizetileImageWidth=size[0]
tileImageHeight=size[1]
# create a new pillow image object that meets psd's 30,000 pixel maximumfinalImageSmaller=Image.new('RGB', (30000, tileImageHeight))
# paste the image horizontally until it fills the canvasxOffset=0whilexOffset<30000:
finalImageSmaller.paste(tileImage, (xOffset, 0))
xOffset+=tileImageWidthpsd=PSDImage.frompil(finalImageSmaller)
psd.save("finalImageSmaller.psb")
# create a new pillow image object that exceeds psd's 30,000 pixel maximum,# but which is smaller than psb's 300,000 pixel maximumfinalImageLarger=Image.new('RGB', (30500, tileImageHeight))
# paste the image horizontally until it fills the canvasxOffset=0whilexOffset<30500:
finalImageLarger.paste(tileImage, (xOffset, 0))
xOffset+=tileImageWidthpsd=PSDImage.frompil(finalImageLarger)
psd.save("finalImageLarger.psb")
Expected behavior
Photoshop should be able to open both finalImageSmaller.psb and finalImageLarger.psb.
Creating a new PSD/PSB file is not tested at all and expect bugs. The bug is that frompil method expects a PSD (not PSB) format, and internally there is a flag that specifies the format in the header section.
For this workload, I would recommend directly opening an image file in Photoshop at this moment.
Describe the bug
I am trying to use Pillow to composite very large gigapixel image files, then save them in the PSB format using psd-tools.
When the image I save to psb is less than 30,000 pixels wide, I have no issues. As soon as my image is greater than 30,000 pixels, however, the psb file saved will not open in Photoshop, which gives me a "Could not complete your request because the file is not compatible with this version of Photoshop" error message.
According to this site, the difference between the psd and psb formats is that psd's support up to 30,000 pixel wide images, whereas psb's support up to 300,000 pixel wide images. This leads me to believe that there is a bug wherein psd-tools can only save psb images that fall under the psd size limit of 30,000 pixels.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Photoshop should be able to open both finalImageSmaller.psb and finalImageLarger.psb.
File and screenshots
These are the two PSB files produced by the above script, as a zip
This is the error I receive in Photoshop when trying to open the larger PSB:
Environment
The text was updated successfully, but these errors were encountered: