Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make the image width fixed when the image is scaled #212

Closed
epubreader opened this issue Nov 27, 2023 · 1 comment
Closed

How to make the image width fixed when the image is scaled #212

epubreader opened this issue Nov 27, 2023 · 1 comment

Comments

@epubreader
Copy link

How to make the width of the picture fixed and keep the original aspect ratio when the picture is scaled?

@coobird
Copy link
Owner

coobird commented Dec 16, 2023

@epubreader, does the width method accomplish what you want to do?

Thumbnails.of("/path/to/image")
    .width(200)
    .toFile("/path/to/thumbnail");

In this example, the thumbnail will have a width of 200 pixels, while the height will be adjusted to maintain the aspect ratio of the original image.

@coobird coobird closed this as completed May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants