question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Circular Image Inside Other

See original GitHub issue

Hey, I want to add a circular image inside other image, like to make a profile, this is the code I have at the moment. But as you see there are two different files the user mask and the bienvenido.png, I want to add user mask instead of memberavatar function, but Im really new at jimp and no one could help me with this at the moment, then my question is, How can I add the first image to the second one¡


exports.run = async (client, message, args, Discord) => {
  var Jimp = require("jimp");
 
 const memberavatar = message.author.displayAvatarURL;
 var channel = client.channels.get("523550838501802004");
   
  
  var p1 = Jimp.read(memberavatar);
var p2 = Jimp.read("https://cloud.githubusercontent.com/assets/414918/11165709/051d10b0-8b0f-11e5-864a-20ef0bada8d6.png");

Promise.all([p1, p2]).then(function(images){
    var user = images[0];
    var mask = images[1];
 user.mask(mask, 0, 0).getBuffer(Jimp.MIME_PNG, (err, buffer) => {
message.channel.send(``,new Discord.Attachment(buffer ,`bienvenido.png`))
})
  

});
  
   var Jimp = require("jimp");
Jimp.read("https://cdn.discordapp.com/attachments/467439114837426196/523583438087782400/hylex.png", function (err, imgprecesada) {
imgprecesada.resize(1024, 450);
Jimp.read(`${memberavatar}`).then(function (memberavatar) {
memberavatar.resize(240, 240)
imgprecesada.composite(memberavatar, 400, 100)
Jimp.loadFont(Jimp.FONT_SANS_64_WHITE).then(function (fuentes) {
imgprecesada.print(fuentes, 320, 20,"BIENVENIDO")
imgprecesada.print(fuentes, 230, 330,`${message.member.user.tag}`)
Jimp.loadFont(Jimp.FONT_SANS_32_WHITE).then(function (fuentemenor) {
imgprecesada.print(fuentemenor, 400, 400,`${message.guild.name}`)
imgprecesada.getBuffer(Jimp.MIME_PNG, (err, buffer) => {
message.channel.send(``,new Discord.Attachment(buffer ,`bienvenido.png`))
})})})})});
};

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
tttedu304commented, Dec 24, 2018

I FKING LOVE YOU!!! ❤️

1reaction
hipstersmoothiecommented, Dec 24, 2018

NOTE: I have not tried to actually make the masking work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crop Photo into Circle or Other Shapes in Word & PowerPoint
Learn how to easily put images into shapes like a circle, heart, arrow, or other picture styles in MS Office without distorting them....
Read more >
How do I put an image inside other shapes like a circle
In this 'InDesign Basics Course' tutorial we'll look at how to put an image inside other shapes like a circle - cropping.
Read more >
Circular Images with CSS - WebFX
Learn how to efficiently use circular images in CSS! In this tutorial, we'll go over some CSS techniques for rendering circular image elements....
Read more >
Crop a circle in image online - free tool
Free tool to crop a circle in the image online, Simple tool, drop your image and adjust the circle cropper to fit the...
Read more >
Circle Crop Images Online in Seconds - Free Circle Cropper
With Fotor's circle cropper, you can crop picture into circle online in just seconds. It also lets you circle crop photos in bulk....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found