Allusion
Allusion copied to clipboard
Proper PSD support
Added an ImageLoader for PSD files based on ag-psd
- It runs in a web worker so it shouldn't impact performance much, except maybe that reading the files still happens in the main thread. PSDs can be big. Could also read files in the worker but that doesn't fit in the current image loading architecture
- It works fine for a dozen PSDs of 3K to 4K resolution on my machine, although they do take a few seconds to load
- Also added a check to re-create thumbnails if the original file was modified after creating the thumbnail
Closes https://github.com/allusion-app/Allusion/issues/496
Thank you very much for this quick answer!
I tried it and I must say it works very well. I'm really impressed that even with heavy psd files it loads them relatively fast and the quality when double-clicking is very good 😄 Also, the change of thumbnail on the files that have been updated is the icing on the cake ✨
While testing it, I've noticed a few flaws that I've tried to debug, but I think they're related to things that are too deep in the code base for me to simply fix:
So I got different results on the generated thumbnails depending on the psd properties, but all of them looked fine when I double-clicked on them.
-
The first case concerns .psd files that were already in my location before I tried this pr: These are strange because they keep their original low-resolution thumbnail but when I double-click on them, I can see their real size (instead of their thumbnail size as before).
-
The second case concerns relatively small .psd (~50 Mb or below) that i've just put in my location folder: All their thumbnails are square and middle centered. You cannot read their size in the metadata panel (when you double-click on them).
- Finally, the last case concerns heavy .psd files (~more than 50 Mb) whose thumbnails are broken at the beginning (like the first one in the first picture), but after reloading Allusion, they appear as the second ones.
So, at the moment, you can't have both a decent quality thumbnail with a correct aspect ratio AND actual dimensions in its info panel. (Actually, you can, but it's mostly a workaround).
I also noticed that the thumbnails generated for the psd files in the ".../AppData/Local/Temp/Allusion/thumbnails" directory are larger than the others. Reading the code, I noticed that you set the size of the largest dimension to 600px, but strangely, on the new psd thumbnails, it's their smallest dimension that is set to 600px (is this intended?).
Ps: I think I found a bug (although it seems to be on the ag-psd side) that occurs when you have at least one custom selection stored in the channel tab of your psd. Even if it is not checked, the generated thumbnail will be masked based on the first top custom layer in that tab (I don't think this is a feature). A simple solution is to generate a saved selection of your entire canvas and place it above your custom layers in the channel tab.
(You can see in the image below the behavior of Allusion based on the state of the psd's channel tab)
This will force Allusion to recreate the psd thumbnail with intended transparency, correct aspect ratio and actual dimensions in the info panel. (Allusion will also recreate a thumbnail in the correct format when you delete a visible layer containing content.)
You can also remove the tooltip next to the psd checkbox in the Image formats menu as it works fine now 👍
Sorry I missed the notification as I am being flooded from work notification. I will take a look in the evening.
Thanks for taking a close look @Krakor92 !
- Good point, we could add a migration step when updating to this version that clears the old PSD thumbnails. We don't have something in place for this yet, might be more difficult than expected
- We're currently relying on exiftool for detecting the resolution of images, which should be able to extract it for PSDs too according to https://exiftool.org/TagNames/Photoshop.html But if that turns out not to reliably work in practice, we could add a fallback so save the resolution we know after creating a thumbnail. Then it'll still appear square at first
- I've seen that happening for other types of images too, which we did put out some fixes for. I'll have a look to see whether there are any errors popping up specifically for PSDs :+1: That thumbnail size issue isn't intentional, will take a look at that too
Nice catch on that last one, sounds like it's worth a bug report over there :smiley:
I've had a quick look around, but I can't find a robust way to trigger logic after upgrading an Electron application (for deleting low res psd thumbnails). We could also just tell people to delete their thumbnail folder in the release notes if it bothers them, then they'll be recreated
Sorry it's taking so long to get released, life got in the way... I'm going to try my best to get it done this weekend!