Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added get_photoshop_blocks() to parse Photoshop TIFF tag #6030

Merged
merged 6 commits into from
Feb 10, 2022

Conversation

radarhere
Copy link
Member

Resolves #6025

TIFF tag 34377 is a "Collection of Photoshop 'Image Resource Blocks'". This PR adds a method, getphotoshopblocks(), to determine what blocks are present in an image. https://www.awaresystems.be/imaging/tiff/tifftags/docs/photoshopthumbnail.html was useful in writing this code.

This PR does not go so far as to format the information within each block. Instead, the bytes are simply deposited within a dictionary under a "data" key. This will allow us to add in more useful information in the future without breaking backwards compatibility. https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727 will be a good resource at that time.

@@ -1128,6 +1131,20 @@ def getxmp(self):
"""
return self._getxmp(self.tag_v2[700]) if 700 in self.tag_v2 else {}

def getphotoshopblocks(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming: I see this follows the other one here -- getxmp -- but how about get_photoshop_blocks for this new one?

Docs: let's at least add a docstring and release notes. Would any other documentation be useful?

(Docstring goes here:)

image

https://pillow--6030.org.readthedocs.build/en/6030/reference/plugins.html#PIL.TiffImagePlugin.TiffImageFile.getphotoshopblocks

@radarhere radarhere changed the title Added getphotoshopblocks() to parse Photoshop TIFF tag Added get_photoshop_blocks() to parse Photoshop TIFF tag Feb 10, 2022
@hugovk
Copy link
Member

hugovk commented Feb 10, 2022

Thank you for the other release notes too!

@hugovk hugovk merged commit f5fab32 into python-pillow:main Feb 10, 2022
@radarhere radarhere deleted the photoshopblocks branch February 10, 2022 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Photoshop EXIF tags are not read
2 participants