Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Mayank Agarwal
Page 30 of 31
How to adjust the contrast of an image using contrast() function in Node Jimp?
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 MoreHow to spin the hue of an image using Jimp in NodeJS?
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 MoreHow to combine two bitmap patterns using Node Jimp Blit Function?
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 MoreHow to blur an image using Node Jimp blur() function?
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 MoreIntroduction to URLSearchParams API in Node.js
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 MoreIntroduction to Sequelize in NodeJS
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 MoreImage Processing with NodeJS JIMP
JIMP, also known as JavaScript Image Manipulation Program, is an image processing library for Node written in JavaScript with no other dependency. It allows the user to easily manipulate the and transform the images into any required shape, format, dimnesion or style. It can also be used for optimizing images to minimize the file size, ensuring high visualquality or reducing the bandwidth.Using JIMP, you can resize and crop images, convert them to the format as needed and also apply different filters and affects. Following are image formats that are supported by NodeJS JIMP −@jimp/jpeg@jimp/png@jimp/bmp@jimp/tiff@jimp/gifInstallationSetup Environment -npm init -yInstalling Dependecy -npm ...
Read MoreensureSymlink() function in fs-extra - NodeJS
Introduction to Async ensureSymlink()This method will ensure whether the symlink exists or not. It will create the directory structure if it does not exist.SyntaxcreateSymlink(srcPath, destPah[, type] [, callback])ParameterssrcPath – The source path of the file.destPath – Destination path of the file.type – This parameter is only available on Windows and ignored on other platforms.The possible values for this parameter is dir, file or junction.callback – This function will give a callback if any error occurs.ExampleCheck that fs-extra is installed before proceeding; if not, install fs-exra.You can use the following command to check whether fs-extra is installed or not.npm ls fs-extraCreate ...
Read MoreIntroduction to ensureFileSync() in NodeJS
This method is used to ensure that a file exists at the given location by using a sync process. The response will only be given after the processing is completed. If the files that is ensured to be created is not present or the respective directories are not present, these directories and files are created. If the file already exists, it is not modified or no change is made.SyntaxensureFileSync(file)Parametersfile – This is a string paramter which will hold the location of the file that needs to be ensured.ExampleCheck that fs-extra is installed before proceeding; if not, install fs-exra.You can use ...
Read MoreensureFile() function in fs-extra - NodeJS
Introduction to Async ensureFile()This method is used to ensure that a file exists at the given location. If the files that is ensured to be created is not present or the respective directories are not present, these directories and files are created. If the file already exists, it is not modified or no change is made.SyntaxensureFile(file, [, callback])Parametersfile – String parameter which will contain name of the file and its location that needs to be ensured.callback – This function will give a callback if any error occurs.Example 1Check that fs-extra is installed before proceeding; if not, install fs-exra.You can use ...
Read More