Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@jimp/plugin-contain
Advanced tools
Contain an image within a height and width.
Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.
import jimp from 'jimp';
async function main() {
const image = await jimp.read('test/image.png');
image.contain(150, 100);
}
main();
The following constants can be passed to image.contain
:
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.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP);
image.contain(
250,
250,
Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM
);
Default align mode for image.contain
is:
Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE;
v0.8.5 (Fri Oct 18 2019)
@jimp/core
@jimp/cli
, @jimp/core
, jimp
, @jimp/plugin-blit
, @jimp/plugin-blur
, @jimp/plugin-color
, @jimp/plugin-crop
, @jimp/plugin-normalize
, @jimp/plugin-resize
, @jimp/plugin-rotate
, @jimp/test-utils
, @jimp/jpeg
, @jimp/png
, @jimp/tiff
, @jimp/types
FAQs
Unknown package
The npm package @jimp/plugin-contain receives a total of 1,006,144 weekly downloads. As such, @jimp/plugin-contain popularity was classified as popular.
We found that @jimp/plugin-contain 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.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.