-
Notifications
You must be signed in to change notification settings - Fork 49
Resize both width and height #278
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
Comments
Hi @AntixK , If it's in a file, the easiest way is with thumbnail: x = pyvips.Image.thumbnail("something.jpg", 200, height=300, size="both") Will size to 200x300 pixels. If it's an image, use |
Argh, sorry, I should not rely on memory. Try:
|
Another related question - How do I set the interpolation method for resizing the image? According to docs, the default seems to be LANCZOS3. My goal here is to get a resized image identical to the one I have with PIL. The Lanczos kernel used there seems to be slightly different (Maybe Lanczos2?). Thank you. |
I don't think you can expect identical results. Image resize is complex, with a lot of unspecified parts, and two different implementations are unlikely to handle issues like rounding and centring in an identical way. |
How do we use Something like this (which is in line with the format in docs) gives error: Reduce docs: https://libvips.github.io/pyvips/vimage.html#pyvips.Image.reduce |
pyvips.Image.new_from_array(image).reduce(2016/9806, 1504/6754, kernel="linear", gap=2) If your image has an alpha you'll probably want to premultiply. You might need to consider gamma as well. The main docs are here: https://www.libvips.org/API/current/libvips-resample.html#vips-reduce |
I wish to resize an image overriding the aspect ratio. I couldn't find a way to do this.
Is there a way to directly give the required size overriding the aspect ratio?
Thanks!
The text was updated successfully, but these errors were encountered: