zhangyuanwei / node-images

Cross-platform image decoder(png/jpeg/gif) and encoder(png/jpeg) for Nodejs
https://npmjs.org/package/images
MIT License
1.56k stars 205 forks source link

Beyond the pixel size limit. 图片尺寸 : 21250 * 7500px 大小:139MB #98

Closed hpze2000 closed 5 years ago

hpze2000 commented 7 years ago

Beyond the pixel size limit. 图片尺寸 : 21250 * 7500px 大小:139MB

请问, 是不支持 这么大的突破的裁剪吗? 还是需要设置什么参数 ?

Error: ..\src\Image.cc:528 Beyond the pixel size limit.
    at Error (native)
    at WrappedImage.prototype.loadFromBuffer (E:\Project\picadmin\node_modules\images\index.js:54:22)
    at WrappedImage.loadFromBuffer (E:\Project\picadmin\node_modules\images\index.js:142:34)
    at Function.images.loadFromBuffer (E:\Project\picadmin\node_modules\images\index.js:212:27)
    at Function.images.loadFromFile (E:\Project\picadmin\node_modules\images\index.js:204:19)
    at images (E:\Project\picadmin\node_modules\images\index.js:172:24)
    at ReadStream.<anonymous> (E:\Project\picadmin\src\home\controller\picture.js:137:9)
    at emitNone (events.js:86:13)
    at ReadStream.emit (events.js:185:7)
    at fs.js:1766:14
    at FSReqWrap.oncomplete (fs.js:117:15)
cuitianze commented 7 years ago

默认处理图片宽高为:

define DEFAULT_WIDTH_LIMIT 10240 // default limit 10000x10000

define DEFAULT_HEIGHT_LIMIT 10240 // default limit 10000x10000

因此请调用这个函数: images.setLimit(width, height)

Set the limit size of each image 设置库处理图片的大小限制,设置后对所有新的操作生效(如果超限则抛出异常)

wangyan9527 commented 3 years ago

设置的没起作用

yajore commented 3 years ago

我碰到了同样的问题,设置了没用依然抛出这个问题