Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
ee-image-worker
Advanced tools
smart, smooth & fast image resizing and cropping
the library is currently rewritten and under development
npm install ee-image-worker
#Usage U can either create an image or a transformation. An image is basically a transformation bound to data (the original buffer). Instantiate the two using the factory methods:
var eeImage = require('ee-image-worker');
var trans = eeImage.createTransformation();
var image = eeImage.createImage(buffer);
Future versions will allow you to inject a processing engine to the factory.
#Basic interface Both enitities support the following interface (fluent):
##pad(color, left, [ upper ]) Adds padding around the image. The color will be converted to the color format of the image.
[0x00, 0x00, 0x00]
for rgb black##crop(width, height, [ offsets ]) Crops the image to width and height. - width number - height number - offsets {top, left, bottom, right} (all are optional, left and top have higher priority)
##resize(width, height, [ filter ])
Resizes the image to the specified dimensions.
- width number
- height number
- filter string ('lanczos', 'catmulrom', 'cubic' ... see picha
)
##scale(dimensions, [ mode ])
Represents specific resizing and cropping actions
- dimensions an object {width: number, height: number} for the default mode (resize
) you can omit one of them and it is resized proportionally
- mode string, the specific mode
- crop covers the passed dimensions and crops off overlapping data
- fit fits the image into the bounds proportionally without removing data
- resize resizing (proportionally if with or height is omitted)
#Transformations
#Image
#Appendix The library will be rewritten to support new features.
Focus by default is at the center of the image and will be adjusted according to the chosen strategy.
##Supported image formats Support depends on the installed libraries
No .gif
support!
##Error handling
To have a consistent error handling we'll wrap picha's
errors.
###Unsupported image file Can be because of an unexpected Buffer format, or a missing library (such as libwebp). We'll probably have to check this upfront. Introduce error codes to distinguish properly.
##Strategies We differentiate two image resizing types:
resize(width, height, filter)
applies a change of dimension without taking the image dimensions into account any precomputationsscale(width, height, strategy, options)
applies a change of dimension following a specific strategy. Strategies can be one of the following
resize
is an ordinary resizingfit
scales the image to fit into a bounding boxfill
scales and crops an image to fill a bounding boxcarve
applies seam carving##Face detection To detect faces is not as easy as we thought. So i propose a combination of multiple detections (faces and eyes): First group all faces that somehow intersect (drop all faces that have no intersection, this might kills some good results).
FAQs
smart, smooth & fast image resizing and cropping
The npm package ee-image-worker receives a total of 0 weekly downloads. As such, ee-image-worker popularity was classified as not popular.
We found that ee-image-worker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.