Open Veragin opened 5 years ago
there is already merged PR for this issue, but isn't released yet #135 so you can work with large files by using master branch instead of version published in npm
I have already seen your issue (#139) and your solve. I forgot to mention that i am using this library in browser (the psd.js file (or psd.min.js file)). And these files are not corrected. Or I didnt find the right ones.
You can build psd.js and psd.min.js usong following commands:
npm install --production cake compile
or, under Windows
node .\node_modules\coffee-script\bin\cake compile
I attached compilled files that use typed arrays. I hope it helps
Thank you very much. You are a genius.
there is already merged PR for this issue, but isn't released yet #135 so you can work with large files by using master branch instead of version published in npm
What time will this version be released?
I also using a large PSD file on browser ( size about 1.2 GB or bigger). And I receive a error:
ERROR: Uncaught (in promise) RangeError: Array buffer allocation failed
Can anyone help me to solve this, pls ?
Hi,
I started using this awsome library. But it has problems with large file (like 100MB and larger)("has problems" means cannot read several image layers). I know there is a lot of articles, saying that, this library is not suitable for large files. But it is possible. Look at https://www.photopea.com/. Its free online photoshop and it can read large .psd files.
I made some research. The problem is with using method toPng():
var des = psd.tree().descendants()[0]; var img = (des.get('image')).toPng();
It returns an image of the layer. It works fine, but allocates a lot of memory, which is not released (for example for 100MB psd file, allocates 300MB for one image (layer)). Its because after using toPng() method, the object psd stores information about layer, like pixelData and so on.This is 100% fine. But why the pixelData stores information (which are only integers between 0-255) as an classic array. I suggest use Uint8ClampedArray array. I believe that this improvement will reduce the memory size of the pixelData array more than 10 times.
This Uint8ClampedArray array is used also in ImageData object (acquired from canvas HTML element). Here is a figure:
I hope my text is comprehensible to developers at least.