feat: render .pxd thumbnails.#1430
Conversation
CyanVoxel
left a comment
There was a problem hiding this comment.
Functionally everything appears to work, though I have a couple nits for the documentation and a big nit for the categorization: Pixelmator is not a part of the iWork suite. iWork has always consisted only of Pages, Keynote, and Numbers. Pixelmator Pro has recently become a part of the Apple Creative Studio, which includes iWork apps along side their other professional grade software and miscellaneous apps like Freeform, but that does not retroactively make any of these part of the iWork suite.
I understand that the code for extracting an embedded thumbnail from a typical iWork file as well as a .pxd file is incredibly similar and seems to share many of the possible internal filenames, so I'd recommend renaming this class to something more generic like _apple_creative_suite_thumb() or _apple_embedded_thumb(). I know that typical iLife files don't have compatible structures with this, and can't speak for how the rest of the files in the creative suite operate, so it may be best to play it as generic as possible. For now I'd also just keep the .pxd extension in the _DOCUMENT_SET, I need to give these sets some attention and do an overall cleanup and reorganization.
| scale_factor = 2.5 | ||
| page_size *= scale_factor | ||
| # Render image with no anti-aliasing for speed | ||
| # Render image with no antialiasing for speed |
There was a problem hiding this comment.
|
|
||
| @staticmethod | ||
| def _iwork_thumb(filepath: Path) -> Image.Image | None: | ||
| """Extract and render a thumbnail for an Apple iWork (Pages, Numbers, Keynote) file. |
There was a problem hiding this comment.
"Extract" is correct here since it's pulling an existing image from an archive, while changing it to simply "Render" is misleading as that gives the impression that the file is being processed and rendered for an image, similar to how the native applications in question would render them, which this is not doing
Summary
Add support for rendering
.pxdthumbnails.Fixes #1409.
As mentioned in the issue,
.pxdfiles store their thumbnails in theQuickLookfolder, similar to the other iWork files, they just use.heicimages instead of.jpg.Preview.heicis checked beforeThumbnail.heicsince its resolution is a bit higher (2000x2000 instead of 1024x1024).Before
After
File used for testing
sample.pxd.txt from #1409.
Tasks Completed