I gave it a bit of a try:
eval "
const image_width = w#0 ; # Width of image being previewed
const image_height = h#0 ; # Height of image being previewed
const image_ratio = image_height / image_width ;
const preview_area_width = ( $_preview_x1 - $_preview_x0) + 1 ;
const preview_area_height = ( $_preview_y1 - $_preview_y0) + 1 ;
const preview_ratio = preview_area_height / preview_area_width ;
1 / ( preview_ratio < image_ratio ? preview_area_width / image_width : preview_area_height / image_height );
"
crop $_preview_x0,$_preview_y0,$_preview_x1,$_preview_y1
The status in Code[Full] does not correspond to it.
This comes close:
norm(image_width,image_height) / norm(preview_area_width,preview_area_height) ;
But, maybe I’m thinking about my problem the wrong way.