RezizerUrl - a NodeJS Rezizer Url Generator
PLEASE, if you wanna use it in browsers DO NOT use a secured version of Rezizer with the SECRET_KEY. Prefer securing by whitelisting your own image domain.
npm install rezizer-url
You can run the test suit with:
You can run tests to validate the hash generation with:
npm run test-hashing
You can run tests against a running instance of Rezizer with:
npm run test-requests
N.B. It will assume that you have a local version of Rezizer running on "http://localhost:8080"
const Rezizer = ;const secretKey = 'OhMyG0shWhatASecretKey!';// start the generatorconst rezizerUrl = '' secretKey;// get the Rezized urlconst imageUrl = rezizerUrl;
- Aligns the image to one of it's edge or to the it's center. If you use
smart()the system will find the most important part of the image and user it as center. They are themselves operations. Usage:
- Sets the background color of the image in color name format, #RRGGBB format or 255,255,255 format , where each channel is an integer from 0 to 255. You can specify
blurryto set the background as a distorted and blurry version of the image or
autoto set the color from the most important color of the image. Available options: color name (
purple), RGB hex color code (
- Blurs the image to value from 1 to 1000.
- Passes a color correction filter on the image.
Available filters: vintage, lomo, clarity, sinCity, sunrise, crossProcess, orangePeel, love, grungy, sepia, jarques, pinhole, oldBoot, glowingSun, hazyDays, herMajesty, nostalgia, hemingway, concentrate, xpro2, lo-fi, rise, hudson, earlybird, nashville.
- Crops a region of the image specified by the top-left coordinate and the bottom-right coordinate of the image. You must specify the four points:
.crop(100, 200, 300, 400)where
100is the top position,
200is the right position, the
300is the bottom position and
400is the left position. Usage:
.crop(10, 20, 100, 110)
- Distorts the image to the match the desired resize dimension. No parameter is expected.
- Extends the informed amount of pixels to each side of the image. The order to be used is: top, bottom, left, right.
.extend(10, 20, 30, 40)
- Detects faces in the image and use them as center of the image for cropping. If you specify the parameter
focused, the image will focus and crop the image to the detected faces, or leave it blank to just align the image to the part that have faces. Usage:
- Maintains the image dimension ratio when resizing, adding black bars to the output image. If you combine it with
background, you will change the color of the bars. Usage:
- Ifs the source image is smaller than the desired resize dimension, it will keep the image's dimension. If it is bigger, the image will be resized.
- Flips the image vertically.
- Flops the image horizontally.
- Changes the output image format.
- Changes the color table of the image to grayscale.
- Inverts the image colors, making it a negative.
- Creates a URL to generate mapping tiles for the informed image. All other operations will be removed when using it.
- Changes the resized dimensions to the max of height and width and fit with the image ratio.
- Changes the max-age header to be used for caching the image on the client side
- Sets the max file size of the output image, in kilobytes.
- Changes the resized dimensions to the min of height and width and fit with the image ratio.
- Expects an URL of a image to be used as a watermark on the output image and placed on a corner specified as the second parameter of the function.
- Retrieves N most important color from the image palette, the values are between 1 and 10. 5 if nothing is specified. All other operations will be removed when using it.
- Sets progressive filter to the JPEG image.
- Sets output quality of the image filter to the JPEG image.
- Sets output dimension of the image with height and width.
- Rotates the image in 90°, 180° or 270°.
- Creates a round corner of the image. The values are percentages between 0 to 100. If no value is specified, it will use 100 as value.
- Creates a URL to generate tiles in the zoomify format for the informed image. The origin image has no size limitations. All other operations will be removed when using it.
- Colorizes the image with a color name format, #RRGGBB format or 255,255,255,1.0 format , where each channel is an integer from 0 to 255 and the alpha channel sits between 0 and 1.
Available options: color name (
purple), RGB hex color code (
.tint(128, 0, 128, .5)or