Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@jimp/plugin-cover
Advanced tools
Changelog
v0.22.1 (Mon Feb 06 2023)
@jimp/core
@jimp/core
, @jimp/custom
, jimp
, @jimp/plugin-blit
, @jimp/plugin-blur
, @jimp/plugin-circle
, @jimp/plugin-color
, @jimp/plugin-contain
, @jimp/plugin-cover
, @jimp/plugin-crop
, @jimp/plugin-displace
, @jimp/plugin-dither
, @jimp/plugin-fisheye
, @jimp/plugin-flip
, @jimp/plugin-gaussian
, @jimp/plugin-invert
, @jimp/plugin-mask
, @jimp/plugin-normalize
, @jimp/plugin-print
, @jimp/plugin-resize
, @jimp/plugin-rotate
, @jimp/plugin-scale
, @jimp/plugin-shadow
, @jimp/plugin-threshold
, @jimp/plugins
, @jimp/test-utils
, @jimp/bmp
, @jimp/gif
, @jimp/jpeg
, @jimp/png
, @jimp/tiff
, @jimp/types
, @jimp/utils
Readme
Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.
import jimp from "jimp";
async function main() {
const image = await jimp.read("test/image.png");
image.cover(150, 100);
}
main();
The following constants can be passed to image.cover
:
Jimp.HORIZONTAL_ALIGN_LEFT;
Jimp.HORIZONTAL_ALIGN_CENTER;
Jimp.HORIZONTAL_ALIGN_RIGHT;
Jimp.VERTICAL_ALIGN_TOP;
Jimp.VERTICAL_ALIGN_MIDDLE;
Jimp.VERTICAL_ALIGN_BOTTOM;
For example:
image.cover(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP);
image.cover(250, 250, Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM);
Default align mode for image.cover
is:
Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE;
FAQs
cover an image.
The npm package @jimp/plugin-cover receives a total of 979,576 weekly downloads. As such, @jimp/plugin-cover popularity was classified as popular.
We found that @jimp/plugin-cover demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.