Imagizer is an node js image processing library that harnesses the power of open CV to process images in JavaScript. It is built on Python Open CV and imutils so you don't have to use a powerful computer plus it's super fast.
- Before usage be sure to have python 3 and pip installed before using imagizer
- only jpg, jpeg, png, raw, psd and svg images are supported
- Image resize
- Image rotate
- Convert Image to black and white
- Blure out image
- Cartoonise image
- Text on image
- Merge images together
- Convert images to video
- Concat 2 images vertically orhorizontally
- Convert an image to pencil sketch
- generate blank image
- generate blank image with text
- draw shape over image
- draw marker over image
- invert image colour
- change image contrast
- crop image
- enhance image
- water color image
npm i imagizer-javascript
Before using the package, be sure to import it:
const imagizer=require('imagizer-javascript')
imagizer.resizeImg(image_path, new_file_name, folder_destination, resize_width).then(image_path=>{
console.log(image_path)
}).catch(err=>{ console.log(err) })
Note: All parameters are required
imagizer.BnW(image_path, new_file_name, folder_destination).then(image_path=>{
console.log(image_path)
}).catch(err=>{ console.log(err) })
Note: All parameters are required
imagizer.rotateImage(image_path, new_file_name, folder_destination, rotate_angle).then(image_path=>{
console.log(image_path)
}).catch(err=>{ console.log(err) })
Note: All parameters are required
imagizer.BlurrImage(image_path, new_file_name, folder_destination).then(image_path=>{
console.log(image_path)
}).catch(err=>{ console.log(err) })
Note: All parameters are required
imagizer.Cartoonize(image_path, new_file_name, folder_destination).then(image_path=>{
console.log(image_path)
}).catch(err=>{ console.log(err) })
Note: All parameters are required
imagizer.TextOver(image_path, new_file_name, folder_destination, text, rgb_for_text, text_size, X_coordinate, y_coordinate, text_font).then(image_path=>{
console.log(image_path)
})
- All parameters are required
- rgb should be sent as a string eg '(0, 0, 0)'
- text_size goes from 0.1 to greater (but for average text size, 0.5- 1 would be okay)
- To use the default rgb, let rgb be undefined
- "FONT_HERSHEY_SIMPLEX"
- "FONT_HERSHEY_PLAIN"
- "FONT_HERSHEY_DUPLEX"
- "FONT_HERSHEY_COMPLEX"
- "FONT_HERSHEY_TRIPLEX"
- "FONT_HERSHEY_COMPLEX_SMALL"
- "FONT_HERSHEY_SCRIPT_SIMPLEX"
- "FONT_HERSHEY_SCRIPT_COMPLEX"
- "FONT_ITALIC"
imagizer.PencilSketchImg(image_path, new_file_name, folder_destination).then(image_path=>{
console.log(image_path)
}).catch(err=>{ console.log(err) })
Note: All parameters are required
imagizer.OverLay(image_one, image_two, new_file_name, image_one_opacity, image_two_opacity, file_destination).then(img_path=>{
console.log(img_path)
})
- All parameters are required
- opacity can take the values 0.1, 0.9, 1.3, etc
- This feature takes a folder that contains images and convert them to an avi video
imagizer.CreateVieo(image_folder, video_name, video_destination).then(video_path=>{
console.log(video_path)
})
Note:
- All parameters are required
- The video always has an avi file extension
- For vertical concatenation
imagizer.ConcatImage(image_one, image_two, new_filename.jpg, file_destination, 'vertical').then(img_path=>{
console.log(img_path)
})
- For horizontal concatenation
imagizer.ConcatImage(image_one, image_two, new_filename.jpg, file_destination, 'horizontal').then(img_path=>{
console.log(img_path)
})
Note:
- All parameters are required
- Specify the file extenstion for the new file name
- This feature helps you create a blank image
imagizer.generateBlankImg(new_filename, file_destination, img_height, img_width, background_rgb).then(image_path=>{
console.log(image_path)
})
- All parameters are required
- set backgroung_rgb to undefined to use default rgb value
- rgb should be sent as a string eg '(0, 0, 0)'
- set rgb to "random" to use randomly generated rgb
- all generated image are have a ".jpg" file extension
- This feature hekps you generate blank images with text over it
imagizer.generateBlankImgWithText(new_filename, file_destination, img_height, img_width, image_rgb, text_rgb, text_y_coordinate, text_x_coordinate, text, text_size, font).then(image_path=>{
console.log(img_path)
})
- All parameters are required
- set rgb to undefined to use default rgb value
- rgb should be sent as a string eg '(0, 0, 0)'
- set rgb to "random" to use randomly generated rgb
- all generated image are have a ".jpg" file extension
- "FONT_HERSHEY_SIMPLEX"
- "FONT_HERSHEY_PLAIN"
- "FONT_HERSHEY_DUPLEX"
- "FONT_HERSHEY_COMPLEX"
- "FONT_HERSHEY_TRIPLEX"
- "FONT_HERSHEY_COMPLEX_SMALL"
- "FONT_HERSHEY_SCRIPT_SIMPLEX"
- "FONT_HERSHEY_SCRIPT_COMPLEX"
- "FONT_ITALIC"
- This feature helps draw sapes over images
imagizer.drawShapeOverImg(file_origin, new_filename, file_destination, point1, point2, rgb, thickness, shape).then(img_path=>{
console.log(img_path)
})
- point 1 and point 2 take in string in the format (x, y) eg "(20, 100)". Point 1 is the starting point of the shape while point 2 is the ending point
- rgb takes in a string in the format "(0, 0, 0)". This is the rgb value of the shape
- thickness takes in an int that specifies the shape thickness (for most cases, 1-4 would suffice)
- shape takes in a string of the shape to be drawn which includes: "circle", "rectangle", "line", and "arrow"
- This feature adds a marker over image
imagizer.drawMarkerOnImg(file_origin, new_filename, file_destination, point, rgb, marker_type, marker_size, thickness).then(img_path=>{
console.log(img_path)
})
- Point takes in string in the format "(10, 20)" which specifies the x and y coordinate
- rgb takes in a string in the format "(0, 0, 0)". This is the rgb value of the marker
- marker type is the marker type to be used. Available options include: "MARKER_CROSS", "MARKER_TILTED_CROSS", "MARKER_STAR", "MARKER_DIAMOND", "MARKER_SQUARE", "MARKER_TRIANGLE_UP", and "MARKER_TRIANGLE_DOWN"
- marker size takes in int that specifies the marker size
- thickness takes in an int that specifies the marker thickness (for most cases, 1-4 would suffice)
- This feature inverts an image colour
imagizer.invertImgColor(file_origin, new_filename, file_destination)
- This feature changes the image contrast
imagizer.contrastImg(file_origin, new_filename, file_destination, contrast_value).then(img_path=>{
console.log(img_path)
})
- Contrast value takes in a number usually between 1.0-5.0 based on your preference
- This feature crops an image
imagizer.cropImg(file_origin, new_filename, file_destination, x1, x2, y1, y2).then(img_path=>{
console.log(img_path)
})
- x1, x2, y1, y2 values take in number parameters. It specifies the start and end point to be cropped eg start from coordinate x1:y1 and end in the coordinate x2:y2
- Enhance image quality
imagizer.enhancePhoto(file_origin, new_filename, file_destination).then((img_path) => {
console.log(img_path)
})
- Give image a water color effect
imagizer.stylePhoto(file_origin, new_filename, file_destination).then(img_path=>{
console.log(img_path)
})