const fs = require('fs')
      const bablu = require('bablu')
      
      const url = 'https://cdn.discordapp.com/emojis/891761238994976788.png';
      
      (async () => {
        // Convert from url
        const imageBuffer = await bablu(url, '#F05454')
        fs.writeFileSync('emoji-red.png', imageBuffer)
      
        // Convert from buffer
        const image = fs.readFileSync('emoji.png')
        const imageBuffer2 = await bablu(image, '#FFC069')
        fs.writeFileSync('emoji-yellow.png', imageBuffer2)
      })()

      Javascript language logo
      manipulating color

      Components

      The code first requires the fs module and then the bablu module. Next, it creates a variable called url which contains the url for the emoji image. The code then calls the bablu() function which takes in the url and the color #F05454. After the function returns, the code writes the emoji image to a file called emoji-red.png. Next, it calls the bablu() function again, this time with the image buffer for the emoji image as the first parameter. The function returns the imageBuffer2. The code then writes the imageBuffer2 to the file called emoji-yellow.png.

      Shortcut: bablu.maipulateColor

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.