pngjs icon indicating copy to clipboard operation
pngjs copied to clipboard

Can't load large image files

Open lowlines opened this issue 2 years ago • 0 comments

The parser-async library doesn't check that the chunk size does not exceed the max buffer size and results in a RangeError [ERR_INVALID_OPT_VALUE]: The value "3221258240" is invalid for option "size" error when loading in very large image files. The image I was looking at was 32768x32768 and the goal was to slice it up into smaller 2000x2000 image tiles.

https://github.com/lukeapage/pngjs/blob/master/lib/parser-async.js#L73

I have not dug too deeply into the source code, but I would imagine you'd need to manage an array of large buffer tiles in order to support loading very large images.

lowlines avatar Mar 11 '22 00:03 lowlines