S
S
SmartReactorApp2019-12-12 16:38:48
Android
SmartReactorApp, 2019-12-12 16:38:48

Image scaling to one width with different height?

How to change the width of images in the application feed to a certain width, while maintaining proportions, and leaving the height "dynamic".
For example, I need to compress a 1920x1280 image to a 455px width without a height parameter. You should get an image with a resolution of 455x256 ( width x height ).
In the same feed, there may be an image with a different resolution of 750x1334 - the width is compressed to 455 and it should be 455x809.
Here is an example of how it will look in the feed:
5df2418f7f1c6782209996.jpeg
How can I make a certain width, but leave a dynamic height while maintaining proportions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Blazhnov, 2019-12-13
@RussMist

You take the width & height of the image, newWidth = 455; newHeight = newWidth * height / width.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question