jimp-dev / jimp

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies.
http://jimp-dev.github.io/jimp/
MIT License
13.84k stars 760 forks source link

marker was not found #830

Open sinhagyandeep opened 4 years ago

sinhagyandeep commented 4 years ago

Respected @oliver-moran , I am working with jimp for the firs time and after installation i am getting an error 'marker was not found'.I have researched about it a lot and i read that you have solved this issue in 0.9.3 version and i am using the same though getting the same issue please help me on this i want to use this node modules for my project cause it fulfills all my requirements on image.

The error screen consist these many files

Error: marker was not found at decodeScan (I:\My_Space\Induce\node_modules\jpeg-js\lib\decoder.js:324:15) at constructor.parse (I:\My_Space\Induce\node_modules\jpeg-js\lib\decoder.js:744:29) at Object.decode [as image/jpeg] (I:\My_Space\Induce\node_modules\jpeg-js\lib\decoder.js:1004:11) at Jimp.parseBitmap (I:\My_Space\Induce\node_modules\@jimp\core\dist\utils\image-bitmap.js:115:53) at Jimp.parseBitmap (I:\My_Space\Induce\node_modules\@jimp\core\dist\index.js:521:32) at I:\My_Space\Induce\node_modules\@jimp\core\dist\index.js:463:15 at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

Jimp.read(tempPath, function (err, test) { if (err) throw err; test.resize(256, 256) .quality(50) .write(destinationPath); }); This is just my code can you tell me what's wrong i am doing? Thanks.

Note : I am uploading an image and reading path from tempFolder .

ChristopherWestphal commented 4 years ago

I just ran into the same problem as already described by @sinhagyandeep using version 0.9.3. It seems like there's a problem with large images. When I reduced the size of the image manually to 50% (JPEG in this case) it worked without throwing the exception.

Code:

Jimp.read(pathImageTemp).then(image => {
   image.autocrop({
   tolerance: 0.1,
   cropOnlyFrames: false,
   leaveBorder: 10
})
.writeAsync(pathImageTemp2)
.then(() => {
[...]