Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Strange behavior with lighteweight images #6

Open
Slava191 opened this issue May 7, 2021 · 0 comments
Open

Strange behavior with lighteweight images #6

Slava191 opened this issue May 7, 2021 · 0 comments

Comments

@Slava191
Copy link

Slava191 commented May 7, 2021

It's not working when i am trying to interract with lightweight images (example: 2.68 kilobyte, 5.36 kilobyte). Promise in my code can't be resolved in lightweight images case. But everything is ok, when aplly it with normal weight images (example: 1 Mb)

    clipperPromise(fileNameWithPath, resizeWidth = 1000){

        return new Promise(function(resolve, reject){

            Clipper(fileNameWithPath, function() {

             if(resizeWidth!== null && this.canvas.width > resizeWidth) this.resize(resizeWidth)

            this.toFile(fileNameWithPath, () => {
                   resolve(fileNameWithPath)
            });

         });

 });

}

Switched to Jimp, and it's work good now in all cases. But in your library speed of resize operation is better! I hope you will fix this issue.

    jimpPromise(fileNameWithPath, resizeWidth = 1000){

        return new Promise(function(resolve, reject){

            Jimp.read(fileNameWithPath, (err, file) => {
                if (err) throw err;

                file
                    .resize(1000, Jimp.AUTO, Jimp.RESIZE_BEZIER)
                    .write(fileNameWithPath); // save

                resolve(fileNameWithPath)

            });
            

        })

    }
@Slava191 Slava191 changed the title Strange behavior with little size images Strange behavior with little weight images May 7, 2021
@Slava191 Slava191 changed the title Strange behavior with little weight images Strange behavior with liteweight images May 7, 2021
@Slava191 Slava191 changed the title Strange behavior with liteweight images Strange behavior with lighteweight images May 7, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant