Resize with keep aspect ratio
See original GitHub issueI’d like to be able to resize an image by keeping a ratio aspect. Right now it is “complex” to do with a new Target and we are losing some great “build in” feature of Picasso.
One example would be for a resize on width:
Picasso.with(context).load(url).resize(400, -1).into(imageView);
Thanks
Issue Analytics
- State:
- Created 10 years ago
- Comments:20 (7 by maintainers)
Top Results From Across the Web
Resize Images Proportionally While Keeping The Aspect Ratio
Use max-width: 100% to limit the size but allow smaller image sizes, use width: 100% to always scale the image to fit the...
Read more >The Trick for Keeping the Same Aspect Ratio When You Crop
Press-and-hold the Shift key, grab a corner point, and drag inward to resize the selection area. Because you're holding the Shift key as...
Read more >CSS force image resize and keep aspect ratio - Stack Overflow
Just replace the height attribute by the aspect-ratio attribute.
Read more >Image Resizer - Crop & Resize Image Online - RedKetchup
Resize an image in pixels, percentage, or ratio online. Downscale or upscale using filters and sharpening. Supports the PNG, JPEG, WEBP, HEIC, GIF,...
Read more >How To Resize Images With Aspect Ratio - Ivertech
Maintaining aspect ratio is also known as "constraining proportions" in some graphic editing software (like Photoshop). It basically means that the width and ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m just confirming that this worked for me. I have the imageView xml set to centerInside then i just specify a width, in my case it is the width of the screen, and then it maintains the aspect ratio. I just pass in 0 for the height.
Picasso.with(context).load(url).resize(width, 0).into(imageView);This is exactly what
centerInside()does.