This page is still a work in progress.
Usage
Canvacord’s built-in image manipulation APIs can be used from canvacord
object. You need to import the canvacord
object from the package as shown below:
TypeScript
ES Modules
CommonJS
import { canvacord } from "canvacord" ;
Image Manipulation (Filters)
The filters API can be used to apply filters to an image, such as hue rotation, saturation, brightness, contrast, and more.
TypeScript
ES Modules
CommonJS
import { canvacord } from "canvacord" ;
const output = await canvacord ( image) . hueRotate ( 70 ) . encode ( ) ;
const output = await canvacord
. filters ( 500 , 500 )
. drawImage ( image)
. hueRotate ( 70 )
. encode ( ) ;
Image Manipulation (Image Generation)
The image generation API can be used to generate images, such as affected image, triggered gif, beautiful image, and more.
TypeScript
ES Modules
CommonJS
import { canvacord } from "canvacord" ;
import { createWriteStream, promises as fs } from "fs" ;
const img = "image-1.png" ;
const img2 = "image-2.png" ;
const img3 = "image-3.png" ;
const affected = await canvacord. affect ( img) ;
fs. writeFile ( "./affected.png" , affected) ;
const triggered = await canvacord. triggered ( img) ;
triggered. pipe ( createWriteStream ( "./triggered.gif" ) ) ;
const fused = await canvacord. fuse ( img, img2) ;
fs. writeFile ( "./fused.png" , fused) ;
const kissed = await canvacord. kiss ( img, img2) ;
fs. writeFile ( "./kissed.png" , kissed) ;
const spanked = await canvacord. spank ( img, img2) ;
fs. writeFile ( "./spanked.png" , spanked) ;
const slapped = await canvacord. slap ( img, img2) ;
fs. writeFile ( "./slapped.png" , slapped) ;
const beautiful = await canvacord. beautiful ( img) ;
fs. writeFile ( "./beautiful.png" , beautiful) ;
const facepalm = await canvacord. facepalm ( img) ;
fs. writeFile ( "./facepalm.png" , facepalm) ;
const rainbow = await canvacord. rainbow ( img) ;
fs. writeFile ( "./rainbow.png" , rainbow) ;
const rip = await canvacord. rip ( img) ;
fs. writeFile ( "./rip.png" , rip) ;
const trash = await canvacord. trash ( img) ;
fs. writeFile ( "./trash.png" , trash) ;
const hitler = await canvacord. hitler ( img) ;
fs. writeFile ( "./hitler.png" , hitler) ;
const distracted = await canvacord. distracted ( img, img2, img3) ;
fs. writeFile ( "./distracted.png" , distracted) ;