npm i
to install all dependencies
npm run dev
to run on local server
npm run build
to build a production bundle
GET http://localhost:3000/api/<image_id>?filters
http://localhost:3000/api/sample.jpg?grayscale=true
- format = jpg | png | webp (default is jpg)
- output file format
- e.g. format=jpg
- resize = width,height
- resize the image
- width and height divided by comma or width in px
- e.g resize=200,100 or resize=200
- crop = left,top,width,height
- crop the image
- left,top,width and height divided by comma in px
- e.g. crop=50,50,200,100
- padding = left,top,right,bottom,color
- pads the edges of the image with the provided background colour.
- left,top,width,bottom and color in rgba or hex
- e.g. padding=2,2,2,2,186:6:144:80 or padding=2,2,2,2,@B80690
- trim = threshold number
- trim "boring" pixels from all edges that contain values similar to the top-left pixel. Images consisting entirely of a single colour will calculate "boring" using the alpha channel, if any.
- e.g. trim=50
- rotate = angle,backgroundcolor
- rotate the image
- AngleInNumber,BackgroundColor in rgba or hex
- e.g. rotate=90,186:6:144:80 or rotate=90,@B80690
- flip = h or v
- flip the image vertically or horizontally
- h for horizontal and v for vertical
- e.g. flip=h or flip=v
- sharpen = sigma,flat?,jagged?
- sharpen the image
- sigma = the sigma of the Gaussian mask
- flat = the level of sharpening to apply to "flat" areas.
- jagged = the level of sharpening to apply to "jagged" areas.
- e.g. sharpen=5,1.0,2.0
- median = number
- apply median filter
- square mask size: size x size
- e.g. median=3
- blur = sigma
- blur the image
- value between 0.3 and 1000 representing the sigma of the Gaussian mask
- e.g. blur=10
- negative = boolean
- make negative copy
- produce the "negative" of the image.
- e.g. negative=true
- normalise = boolen
- enhance output image contrast by stretching its luminance to cover the full dynamic range.
- enhance output image contrast by stretching its luminance to cover the full dynamic range.
- e.g. normalise=true
- clahe = width,height,maxSlope
- enhance the clarity of the image by bringing out darker details.
- maxslope is a maximum value for the slope of the cumulative histogram, valid values are integers in the range 0-100
- clahe=200,100,50
- threshold = number
- any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
- can be used in grayscaling the image
- e.g. threshold=100
- modulate = brightness,saturation?,hue?
- transforms the image using brightness, saturation, hue rotation
- e.g = modulate=2,2,180
- brightness = number
- adjust brightness of the image
- e.g. brightness=5
- hue = deegree
- adjust hue of the image
- eg. hue=180
- saturation = number
- adjust saturation of the image
- e.g. saturation=2
- grayscale = boolean
- make grayscale copy the image
- e.g. grayscale=true
- text = left,top,font-size,fill,font-weight,text
- add text on top of image
- e.g. text=20,20,14,@B80690,500,Hello World
- overlay = left,top,imageId
- to add image on top of image
- e.g. overlay=50,50,overlay.png
for more detail on each filter please visit sharp lib documantation