Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Image quality degrades after compositing #365

Closed
khyokhyo opened this issue Nov 13, 2017 · 2 comments
Closed

Image quality degrades after compositing #365

khyokhyo opened this issue Nov 13, 2017 · 2 comments
Labels
bug there is a bug in the way jimp behaves

Comments

@khyokhyo
Copy link

khyokhyo commented Nov 13, 2017

The original image is -
main_512x512

After compositing it looks like -
new

My code is :

function getFormattedImage(url, width, height) {
  return new Promise((resolve, reject) => {
    new Jimp(width, height, 0xffffffff, async function(err, image) {
      if (err) {
        reject(err);
        return;
      }
      image.write('canvas.jpg', async function(err) {
        if (err) {
          reject(err);
          return;
        }
        const images = [url, 'canvas.jpg'];
        const jimps = [];
        for (let i = 0; i < images.length; i++) {
          jimps.push(Jimp.read(images[i]));
        }
        const data = await Promise.all(jimps);
        data[1].composite(data[0], 12, 12).write('new.jpg', async function(err) {
          if (err) reject(err);
          else {
            resolve();
          }
        });
      });
    });
  });
}

Why is this happening? Can you help?

TIA

@hipstersmoothie
Copy link
Collaborator

@khyokhyo @riatzukiza @bruno-serfe

I can't really see whats wrong with the second image. can you point me towards whats wrong? also this might just be an issue with jpeg-js.

Can you try just reading then immediately writing? Does the issue persist? If it does this is more likely a dupe of #121 and not an issue with composite.

@hipstersmoothie hipstersmoothie added bug there is a bug in the way jimp behaves and removed bug-issue labels Aug 26, 2018
@hipstersmoothie
Copy link
Collaborator

I think this is for sure a dup of #121 and has nothing to do with compositing. Closing in favor of #121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug there is a bug in the way jimp behaves
Projects
None yet
Development

No branches or pull requests

2 participants