Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@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.22.9 (Wed Jul 26 2023)
:tada: This release contains work from new contributors! :tada:
Thanks for all your work!
:heart: Artur (@Artur-)
:heart: Tim O. (macer) (@gitmacer)
:heart: aab (@aabccd021)
:heart: Zsolt Medgyesi (@zmedgyes)
:heart: Nicolas Morel (@Marsup)
FAQs
Unknown package
The npm package @jimp/plugin-contain receives a total of 1,053,024 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.