Found 285 Articles for Node.js

How to change an image to greyscale in Node Jimp?

Mayank Agarwal
Updated on 27-Apr-2021 13:28:42

1K+ Views

NodeJS – Grayscale() is an inbuilt function that is used to desaturate an image color into gray depending upon the amount between 0 to 100. The grayscale is basically the conversion of an image into gray from their original colors.Syntaximage.color([    {apply: 'greyscale', params: [value], cb } ]);Definition of greyscale() paramtersvalue – It takes the input for the parameter value to apply the greyscale. The range will be from 0 to 100.cb – This is an optional parameter that can be invoked after the compilation is complete.Input ImageUsing Node JIMP – GREYSCALE()Before proceeding to use greyscale() functions, please check that ... Read More

How to flip an image in Node Jimp?

Mayank Agarwal
Updated on 27-Apr-2021 13:24:43

512 Views

NodeJS – Flip() is an inbuilt function that is used to flip the images. The images can be flipped either vertically or hoizontally as defined in the function. By default, the images are flipped horizontally.Syntaxflip(h, v, cb)Definition of flip() paramtersh – It takes a boolean value as an input. Image will be flipped horizontally if this is TRUE.v – It takes a boolean value as an input. Image will be flipped vertically if this is TRUE.cb – This is also an optional parameter that can be invoked after the compilation is complete.Input ImageUsing Node JIMP – FLIP()Before proceeding to use ... Read More

How to crop an image using crop() function in Node Jimp?

Mayank Agarwal
Updated on 27-Apr-2021 13:20:30

3K+ Views

NodeJS – Crop() is an inbuilt function that is used to crop the images. We can use crop to select/crop an image within specified coordinates and dimnesions.Syntaxcrop( x, y, w, h, cb )Definition of crop() paramtersx – It will hold the value of x co-ordinate of cropping. (Required)y – It will hold the value of y co-ordinate of cropping. (Required)w – This parameter is used to store the width of the cropping image. (Required)h – This parameter is used to store the height of the cropping image. (Required)cb – This is an optional parameter that can be invoked after the ... Read More

How to adjust the contrast of an image using contrast() function in Node Jimp?

Mayank Agarwal
Updated on 27-Apr-2021 13:16:25

602 Views

NodeJS – Contrast() is an inbuilt function that is used to adjust the contrast of images. It will increase or decrease the contrast based upon the input value that ranges from -1 to +1.Syntaxcontrast(n, cb)Definition of contrast() paramtersn – It will take n as an input for adjusting the contrast of the image, Possible values of n is between -1 and +1.cb – This is an optional parameter that can be invoked after the compilation is complete.Input ImageUsing Node JIMP – CONTRAST()Before proceeding to use contrast() functions, please check that the following statements are already executed for setting up the environment.npm init ... Read More

How to spin the hue of an image using Jimp in NodeJS?

Mayank Agarwal
Updated on 27-Apr-2021 13:10:22

220 Views

NodeJS – spin modifier is an inbuilt function that is used to spin the hue of an image to a given amount from -360° to 360°. We can spin the color from 0 to 360, but it will not perform any function, as it sets the hue back to what it was before.Syntaximage.color([    {apply: 'spin', params: [value] } ]);color() paramtersvalue – It will store the amount of hue to be applied while spinning. Its possible values are from -360 to 360.Input ImageUsing Node JIMP – COLOR – SPINBefore proceeding to use color() – spin functions, please check that the ... Read More

How to blur an image using Node Jimp blur() function?

Mayank Agarwal
Updated on 27-Apr-2021 12:20:25

1K+ Views

NodeJS – Blur() is an inbuilt function that is used to blur images. The effect produced by JIMP blur() will be similar to that of the Gaussian blur. It blurs based on the pixels input.Syntaxblur(r, cb)Definition of blur() paramtersr – It takes the input for blur and blurs based upon the pixels. If r is 2, it will blur 2 pixels at a time.cb – This is an optional parameter that can be invoked after the compilation is complete.Input ImageUsing Node JIMP – BLUR()Before proceeding to use blur() functions, please check that the following statements arealready executed for setting up the ... Read More

How to combine two bitmap patterns using Node Jimp Blit Function?

Mayank Agarwal
Updated on 27-Apr-2021 12:22:29

493 Views

This NodeJS – Blit() is an inbuilt function that is used to combine two bitmap patterns. It can also be used for combining several bitmaps into one using a boolean function.Syntaxblit(src, x, y, [srcx, srcy, srcw, srch])Definition of blit() paramterssrc – It will store the source image for blit.x – It will take input for x to blit the image.y – It will take input for y to blit the image.srcx – It is an optional parameter that will take the x-position to crop the source image.srcy – It is an optional parameter that will take the y-position to crop the source image.srcw – ... Read More

Introduction to URLSearchParams API in Node.js

Mayank Agarwal
Updated on 27-Apr-2021 11:24:17

474 Views

Node is an open source project that is used to create dynamic web applications. The URLSearchParams API is an interface. It defines different utility that is required to work with the query string of the URL.In this article, we will discuss the four different constructors of URLSearchParams that can be used as per the requirement.new URLSearchParams()This is a no argument constructor and therefore only used to initialize a new Empty URLSearchParams() object.Syntaxvar params = new URLSearchParams();new URLSearchParams(string)This constructor can accept a string as an input parameter along with instantiating a new URLSearchParams object.Syntaxconst params = new URLSearchParams('firstName=pqr & lastName=xyz');   ... Read More

Introduction to Sequelize in NodeJS

Mayank Agarwal
Updated on 27-Apr-2021 11:22:34

2K+ Views

Sequelize follows a promise-based Node.js ORM structure for different databases like – Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. Sequelize have multiple features which makes it easy to implement and use.Some of the main features of sequelize are as follows −Sequelize is a third-party package.It uses an Object-Relational Mapping to map objects. That's why its called an ORM.Sequelize supports solid transaction support along with eager and lazy loading concept.It can also perform read replication on databases.Sequelize follows standardization, which means it has a single schema definition in the code. Standardization makes the schema easy to read and understand along ... Read More

Inserting Records into Table using Node

Mayank Agarwal
Updated on 27-Apr-2021 11:20:34

482 Views

In this article, we will see how we can insert data into a table using NodeJS. Read the complete article to understand how we can save data into the database table.Before proceeding, please check the following steps are already executed −mkdir mysql-testcd mysql-testnpm init -ynpm install mysqlThe above steps are for installing the Node - mysql dependecy in the project folder.Insert a Record into the Students TableFor adding the new records into the MySQL table, firstly create an app.js fileNow copy-paste the below snippet in the fileRun the code using the following command>> node app.jsExample// Checking the MySQL dependency in ... Read More

Advertisements