# Zoom progression not linear

I have an algorithm for the editing of an image. There is an image and a rectangle that is smaller than the image (e.g. 3/4 of it) and that represents a section of the image. This section has to be zoomed in or out. It's okay, if the section gets bigger than the image.

Starting basis of the calculations (values relating to the section):

• zoom_factor in range from 0 to 5 (< 1 means zoom in, > 1 means zoom out) (this value is converted, originally it's from -1 to 1, negative meaning to zoom out)
• previous_width (e.g. 800)
• previous_height (e.g. 600)
• previous_x (left margin)
• previous_y (top margin)

("previous" doesn't mean that multiple zooms are made in succession.)

Calculations:

• width = previous_width * zoom_factor
• height = previous_height * zoom_factor
• x = previous_x + (previous_width - width) / 2
• y = previous_y + (previous_height - height) / 2

At the end the section with its contents is always resized to a fixed size (with the same aspect ratio).

The problem is: The zoom progression is not linear. Why? And how can that be changed?

-
 What do you mean by "zoom progression"? – Arkamis Jul 19 '12 at 17:50 I mean: When I go through the algorithm multiple times with an increasing or decreasing zoom_factor. – human-man Jul 19 '12 at 18:33 But what about it is non-linear? Non-linear with respect to what? – Arkamis Jul 19 '12 at 18:34 Yes, it is not linear. We have $1.5\times 1.5=2.25$, not $1.5\times 1.5=3$. – André Nicolas Jul 19 '12 at 19:24 The file can be closed. I hadn't had a well-defined zoom factor. Now I do it as in GIMP: 100% is normal size, 200% double size, 50% half size. Thanks for your attention! – human-man Jul 19 '12 at 20:17