rotateimage
Description
rotateimage rotates an 8-bit OMG1 (JHC_header) image by 90° clockwise (default, swapping xmax/ymax and dx/dy), flips it horizontally left-to-right (-hflip), or rotates it by an arbitrary angle (-rotate_angle <deg>) about a specified pixel center (-cen <x> <y>) while keeping the original grid dimensions.
CLI Options & Usage
rotateimage -in <infile> -out <outfile> \
[-hflip | -rotate_angle <deg> [-cen <cx> <cy>]]
-in <infile>: Input 8-bitOMG1(JHC_header) raster file.-out <outfile>: Output rotated/flipped 8-bitOMG1raster file.-hflip: Mirrors each scanline horizontally (out[i, j] = in[xmax - 1 - i, j]) without rotating.-rotate_angle <deg>: Rotates the image by<deg>degrees around(cx, cy), filling out-of-bounds corners with255and preserving originalxmax à ymaxdimensions.-cen <cx> <cy>: Rotation pivot pixel coordinates for-rotate_angle(defaults to image center(xmax/2, ymax/2)).
Algorithm
- Default (90° Clockwise): Sets
out_head.xmax = in_head.ymax,out_head.ymax = in_head.xmax, swapsdxanddy, and mapsout[in_ymax - 1 - j, i] = in[i, j]. - Arbitrary Angle (
-rotate_angle): For each output pixel(i, j), computes polar offset(range, dir)from(cx, cy), rotates bydir -= rotate_angle, and samplesin[cx + range*sin(dir), cy + range*cos(dir)].