allusion-app/Allusion

Improved and more reliable PSD support

Krakor92 opened this issue · 1 comments

Hello,

First of all thank you for this great application, I downloaded it today and I find it very pleasant and intuitive to use.

The tag system is a treat to use, but I expected better integration of the psd format.
Currently, not only is the thumbnail very low resolution, but some (if not most) of my psd files do not display a thumbnail at all:

Allusion thumbnail error

I looked at this thread where you implemented psd support and it says that you used exiftool which can only extract a low resolution thumbnail. But it would be so much better if the psd thumbnail was the same size as the canvas (like in XnView MP).


I looked for alternatives to extract high-res image from psd files and the first lib I came across was ag-psd. Not only does it works flawlessly with all my psd files (within the limits of what the library can render) but you get a 1:1 image of the canvas in a minimal number of lines :

const fs = require('fs');
require('ag-psd/initialize-canvas');
const { readPsd } = require('ag-psd');

const buffer = fs.readFileSync('art.psd');

// read document structure and image data
const psd2 = readPsd(buffer);

fs.writeFileSync('art.webp', psd2.canvas.toBuffer());

However, generating the image may take some time, especially if the file is large: For example, it took me about 15s to build an uncompressed webp image of 7000x1800 resolution from a 180mb~ psd file (with about 150 active layers).
Anyway I'd rather wait longer at first launch for it to build high-resolution previews than have faster but partial/broken psd support as is currently the case.

The only drawback I would see is its size: the library weighs 3mb without its dependencies. I don't realize how much this would increase the size of the executable compared to the standalone exiftool library, so that's something to consider.

thanks for the recommendation, we must've overlooked that one while trying to find a more generic image loader. It seems to do the job pretty well! I've implemented a new image loader class that wraps ag-psd in #498

The size of the library shouldn't be an issue, its bundle size is much smaller than that, and we've got WebPack that should reduce it even more by stripping away its functionality that we don't use