image processing in node js with jimp

Solutions on MaxInterview for image processing in node js with jimp by the best coders in the world

showing results for - "image processing in node js with jimp"
Chloe
30 May 2019
1/*
2    This code comes from Vincent Lab
3    And it has a video version linked here: https://www.youtube.com/watch?v=xjrI_9V07fY
4*/
5
6// Import dependencies
7const Jimp = require("jimp");
8
9(async function () {
10
11    // Read the image
12    const image = await Jimp.read("images/shapes.png"); // http://www.example.com/path/to/lenna.jpg
13
14    // // Add text
15    //  const font = await Jimp.loadFont(Jimp.FONT_SANS_16_WHITE); // bitmap fonts
16    //  image.print(font, 0, 0, 'Hello world!'); // https://github.com/libgdx/libgdx/wiki/Hiero
17
18    //  // Resize the image 
19    //  // Resize the image to 250 x 250
20    //  image.resize(250, 250);
21
22    //  // Resize the height to 250 and scale the width accordingly
23    //  image.resize(Jimp.AUTO, 250);
24
25    //  // Resize the width to 250 and scale the height accordingly
26    //  image.resize(250, Jimp.AUTO);
27
28    //  // Add a sepia wash to the image
29    //  image.sepia();
30
31    //  // Pixelation 
32    //  image.pixelate(5);
33    //  image.pixelate(5, 50, 50, 190, 200); pixe,x, y, w, h 
34
35    //  // Clone
36    //  const image2 = image.clone();
37
38    //  // Blur the image
39    //  image.gaussian(1);
40    //  image.blur(1);
41
42    //  // Inverts the image
43    //  image.invert(); 
44
45    //  // Set the brightness
46    //  image.brightness( 0.5 ); // -1 to +1
47
48    //  // Resize the image
49    //  image.resize(256, 256);
50
51    //  // Set the quality
52    //  image.quality(100);
53
54    //  // Convert to grayscale
55    //  image.greyscale();
56
57    // Save the image
58    image.write("images/edited-shapes.png"); // writeAsync
59
60})();