I’m developing an application in AS3 that loads in a scaled image (resolution and dimensions scaled down), manipulates it (zoom/rotate) and then sends the info back to PHP to make the changes to the original image. The problem I’ve been having for hours now is figuring out how to translate the changes made in the Flash application to the full-scale image.
Original Image
1500px x 2100px @ 300ppi
Scaled and Sent to Flash App
450px x 630px @ 72ppi
Scaled Down in Flash App
400px x 560px, still @ 72ppi
Now, when I send the 400px x 560px back to PHP, how do I translate that change to the original image? It’s not as simple as reducing the original image by the same percentage as the scaled image was reduced in the Flash App.
This is what I have so far, but the new dimensions always come out too small:
scale_difference = orig_img_resolution/72; // 300/72
scale_change = img_width_from_app/orig_img_width; // Scale change
new_width = orig_img_width* (scale_changescale_difference);
new_height = orig_img_height (scale_change*scale_difference);