<p>I have a process where a web user selects a photo for a profile image. User is then presented with a canvas to zoom, rotate and move their image within a square viewport. Once satisfied, the user submits and the original image along with the adjustment settings are posted to the server.</p>
<p>I need to find the most efficient way to produce the same end result using the original image but with the highest quality/size allowed.</p>
<p>I could apply the submitted scale to all the properties and get the exact outcome but it would be in the size of the &quot;viewport&quot; which is 290px-400px square depending on the user's device size. I need that final image to be the maximum size allowed for the job. i.e. if the max size is 1000x700, the final image would be 700x700 if the original image was large enough compared to the submitted scale.</p>
<p>Here are a couple of examples:
<a href="https://i.sstatic.net/b1f0u.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/b1f0u.png" alt="enter image description here" /></a></p>
<p>I dont need the programming/syntax help I need the math help! Shouldnt matter but if it helps I am using C# for this.</p>
<p>Using the available variables in the example above, what would be the best approach to determine the maximum image size / scale allowed?</p>

CC BY-SA 4.0
2022-09-07T17:09:27.240Z
I'm not sure I understand exactly your problem but it seems like this could be simplified by using fractional 0-to-1 values to define where the crop box is in the image, instead of pixel values. Then it would apply equally to any size of image.
Nathan Reed
CC BY-SA 4.0
2022-09-07T17:30:23.970Z
Nathan, I think my problem is figuring out what my first problem is :D I think what I need (first) is to figure out what scale would give me the maximum allowed, cropped image size... In the above examples, max size is 1000x700. So with a square crop the max size would be 700x700. But what if the original image was 700x600? The max cropped size would be 600x600 (so there is no upsizing). I *think* I need to determine this and then I can apply that scale to all other properties and get the final image. Right?
johnw182
<mathematics><computational-geometry><image-processing><image><coordinates>
Automate Image resize, scale, position for best quality (size)
johnw182
# Automate Image resize, scale, position for best quality (size)

(Asked by: username_0 on 2022-09-07)

I have a process where a web user selects a photo for a profile image. User is then presented with a canvas to zoom, rotate and move their image within a square viewport. Once satisfied, the user submits and the original image along with the adjustment settings are posted to the server.

I need to find the most efficient way to produce the same end result using the original image but with the highest quality/size allowed.

I could apply the submitted scale to all the properties and get the exact outcome but it would be in the size of the "viewport" which is 290px-400px square depending on the user's device size. I need that final image to be the maximum size allowed for the job. i.e. if the max size is 1000x700, the final image would be 700x700 if the original image was large enough compared to the submitted scale.

Here are a couple of examples:
[![enter image description here](https://i.sstatic.net/b1f0u.png)](https://i.sstatic.net/b1f0u.png)

I dont need the programming/syntax help I need the math help! Shouldnt matter but if it helps I am using C# for this.

Using the available variables in the example above, what would be the best approach to determine the maximum image size / scale allowed?

**Tags:** mathematics, computational-geometry, image-processing, image, coordinates

> **Comments:**
> **username_1**: I'm not sure I understand exactly your problem but it seems like this could be simplified by using fractional 0-to-1 values to define where the crop box is in the image, instead of pixel values. Then it would apply equally to any size of image.  
> **username_0**: username_1, I think my problem is figuring out what my first problem is :D I think what I need (first) is to figure out what scale would give me the maximum allowed, cropped image size... In the above examples, max size is 1000x700. So with a square crop the max size would be 700x700. But what if the original image was 700x600? The max cropped size would be 600x600 (so there is no upsizing). I *think* I need to determine this and then I can apply that scale to all other properties and get the final image. Right?  

---

## 0 answers

