Skip to content

Circular Image Issue #727

@Aries-Spring

Description

@Aries-Spring

Expected Behavior

Expected Images to be cropped in a circular shape and resized

Current Behavior

Refer to screenshot

Failure Information (for bugs)

Refer to screenshot

Steps to Reproduce

``const imgFileName = 'forest-blue-1.jpg';
let backgroundImgUrl = Jimp.read(
./assets/profile_backgrounds/${imgFileName}
);
let avatarImgUrl = Jimp.read(member.user.avatarURL);
let circleMaskUrl = Jimp.read('./assets/masks/circle.png');

  Promise.all([backgroundImgUrl, avatarImgUrl, circleMaskUrl]).then(
    async images => {
      const backgroundImg = images[0];
      const avatarImg = images[1];
      const circleMask = images[2];

      avatarImg.mask(circleMask, 0, 0).resize(192, 192);

      const image = await backgroundImg
        .resize(1050, 600)
        .composite(avatarImg, 100, 204)
        .getBufferAsync(Jimp.MIME_PNG);
      message.channel.send(new Attachment(image, 'profile.png'));
    }
  );``

Screenshots

profile

Context

Trying to take Discord server's avatar (using Discord.js) then cropping that image into circular shape and resizing it, then compositing on a background

  • Jimp Version: 0.6.4
  • Operating System: Windows 10
  • Node version: v11.11.0

Failure Logs

No logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions