## image cropping syntax

Help
Anonymous
2012-08-16
2013-12-20

• Anonymous
2012-08-16

Ruven et al... I wanted to double check something...

So I am trying to crop out a small region (say 100x100) from a large image...

say my initial image = 25,000 by 50,000 Pixels... and I want to extract/crop
out a small region from this full resolution image..

Say centroid of object = 1050,1050 and I want to extract a 100 pixel box
surrounding that object...

Since everything is in % coordinates, and not pixels... My understanding is I
would have to do the following

So the upper left coroner of the box I want would be 1000,1000 and I want to
grab the image from 1000,1000 to 1100,1100

I would do something like

percent_x_coord = 1000/25000
percent_y_coord = 1000/50000

and then to figure out the width/height of the box it would simple by
100/25000 and 100/50000?

\$box_width = 100/25000
\$box_height = 100/50000

"FIF=/MYBIGGTIFF&RGN=\${percent_x_coord},\${percent_y_coord}".
",\${box_height},\${box_width}&CVT=jpeg";

Also if I got lazy and didn't feel like calculating the box height and
width... if I passed a WID=100 before the region command... would it then
return me the desired 100x100 pixel image?

• Ruven
2012-08-17

You need to set the 4 parameters of x,y,width, height of your region. The WID
refers to the width of the resolution level you are referring to. So as you
want this 100x100 px region from an image of size 25,000 x 50,000 you should
set WID=25000. If you set WID to, say, 12500 with the same x,y,w,h you will
get the same region, but proportionally scaled to 50x50.

• fdiamge
2013-12-16

the width and height is quite important when you are cropping image so define if before processing.

Anonymous