question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resize with keep aspect ratio

See original GitHub issue

I’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:closed
  • Created 10 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

29reactions
lawloretiennecommented, Dec 2, 2015

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);

11reactions
JakeWhartoncommented, Sep 3, 2013

This is exactly what centerInside() does.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found