I am trying to scale one img based on its size on the screen to a size of max space on my paper. I want to get a percentage so that way I could just plug it into my calculator and easily convert each size of the elements of the img to the proportional size of the space provided. The space on the paper is not proportional to the size of the original img. So the draw img doesn't have to take up the whole space in the space on the paper. The space is just for reference of how much is available.
Asked
Active
Viewed 71 times
1 Answers
1
I'm not sure exactly what you're looking for, but here's an example problem in this general domain. Suppose you have an original picture of dimensions $W \times H$, and you need it to fit into a space with dimensions $x \times y$.
Then compute $r_1 = x/W$ and $r_2 = y/H$, and find $r = \min\{r_1, r_2\}$. That is the scaling factor of the maximal copy of the original that will fit into the given space. The basic reasoning is that a scaling of $r_1$ will get the picture to fit just right horizontally, while a scaling of $r_2$ will get the picture to fit just right vertically. In order for it to fit in both directions, the picture must be scaled to the minimum of those two.
Brian Tung
- 34,160
-
What does "r" mean? Is it rectangle? – RetroCUBE Sep 02 '17 at 23:49
-
It doesn't really matter what it's called, but I intended it to represent "ratio". – Brian Tung Sep 02 '17 at 23:50
-
Would finding the size of the space to draw in and multiplying it by 100 and deciding it by the original size get your the same answer? If so how would I go about converting the elements from the original to the new using the percentage gotten here? – RetroCUBE Sep 03 '17 at 00:17
-
What does minimum mean? – RetroCUBE Sep 03 '17 at 05:53
-
Also would the picture be proportional to the original even if the drawing space is smaller by x and larger by y. That doesn't seem to possible. – RetroCUBE Sep 03 '17 at 06:33
-
@GoalBike to answer your questions in the comments: 1) not sure what you mean, but you can multiply r1 & r2 by 100% to get the percentage, 2) use the lower percentage of r1 and r2 to scale the image, 3) I believe "minimum" is "the lowest between those two", as explained from 1 & 2, and 4) yes, because you will multiply both W & H by r (either r1 or r2, the lowest one) – Andrew T. Sep 03 '17 at 17:24