Open In App
Related Articles

Node Jimp | Blit

Improve Article
Save Article
Like Article

The blit() function is an inbuilt function in Nodejs. It is used to combine two bitmap patterns. | Jimp which combines several bitmaps into one using a boolean function.


  • src – This parameter stores the source of the image to blit.
  • x – This parameter takes x position to blit the image.
  • y – This parameter takes y position to blit the image.
  • srcx (optional) – This parameter takes the x position from which to crop the source image.
  • srcy (optional) – This parameter takes the y position from which to crop the source image.
  • srcw (optional) – This parameter takes the width to which to crop the source image.
  • srch (optional) – This parameter takes the height to which to crop the source image.
  • Input Images:

    Example 1:

    // npm install --save jimp
    // import jimp library to the environment
    var Jimp = require('jimp');
    // User-Defined Function to read the images
    async function main() {
      const image1 = await'../gfg.png');
      const image2 = await'../gfg1.png');
      // call to blit function along with optional parameters
      image1.blit(image2, 20, 40, 130, 30, 440, 80);
      // write image
      console.log('Image Processing Completed');



    Example 2:




    Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

    Last Updated : 23 Apr, 2019
    Like Article
    Save Article
Similar Reads
Complete Tutorials