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
14.04k stars 760 forks source link

All images made on Windows have size 0 #126

Closed simonh1000 closed 8 years ago

simonh1000 commented 8 years ago

I use this snippets

        return jimp.read(srcFileName)
            .then( img => {
                img
                .resize(width, jimp.AUTO)
                .quality(75)                 // set JPEG quality
                .write(destFileName);

                returnObj.fname = destFileName;
                console.log("Created new image:", srcFileName);

                return resolve(returnObj);
            })
            .catch (err => reject(err) );

the files are being created but have size 0 bytes in Win 10. All working on Ubuntu though. What could be wrong?

oliver-moran commented 8 years ago

Hmmm ... sorry for being so slow getting back. Is this issue still presenting?

oliver-moran commented 8 years ago

Can't reproduce on Windows 7 using the following test script:

var Jimp = require("jimp");

Jimp.read("lenna.png").then( img => {
    img
    .resize(100, Jimp.AUTO)
    .quality(75)
    .write("lenna-100px.png");
})
.catch (err => reject(err) );

Does it still present on Windows 10?

simonh1000 commented 8 years ago

I'll close as I have shipped code, so I think it must have fixed itself

bckr75 commented 4 years ago

This is still NOT FIXED, Jimp still saves 0 bytes images. Using Windows 10 Pro 1909. Simply reading resizing and saving. Trying to save img anytime in code causes 0 bytes images being saved.

bckr75 commented 4 years ago

I'll close as I have shipped code, so I think it must have fixed itself

Nope it's obviously not

Umopepisdn commented 4 years ago

I'm seeing this too, but only in my production app, not my module tester...

andrewrproper commented 3 years ago

I found an interesting situation. If I use image.write("filename.jpg") from within an async function which is called from a Promise, then it doesn't complete until the top-level Promise is completed, even if I use await.

The fix is to use the Async version every time it is being called from within any async process: image.writeAsync("filename.jpg"); I think I'll probably only use writeAsync going forward. The other one was creating strange problems, when used within async and Promises.