Unfortunately TRANSFORM PICTURE applies the cropping coordinates to the full 
size picture not the scaled picture, which of course is way off

is there a reason why your image is scaled on screen?

did you scale the image with TRANSFORM PICTURE or are you relying on the 
image's form object property to apply the scaling?

if the area is fixed size,
it might make your maths more simple
if it the image were resampled with CREATE THUMBNAIL
as a bitmap thumbnail to fit the exact area.

also the form rendering would be faster if the object had no scaling property.

---

the scaling factor of a proportional image depends on its orientation and the 
type of scaling you apply (e.g. xMidYMid):

c.f. 
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio

---

unlike resampling with CREATE THUMBNAIL,
scaling with TRANSFORM PICTURE does not reduce the image quality.
the result is the same as letting the form object do the scaling,
except you have control over the ratio.

https://doc.4d.com/4Dv17/4D/17.1/TRANSFORM-PICTURE.301-4179105.en.html

---

but to answer you question,

Is there a mathematical way to do this? Or perhaps another way to get this 
cropping to work?

we have to figure out the maths.
there is no other way.



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to