OMGtoPS
Description
OMGtoPS converts an 8-bit OMG1 (JHC_header) greyscale raster image into a standalone Encapsulated PostScript (EPSF-2.0) file suitable for high-resolution laser printing or inclusion in publication figures.
CLI Options & Usage
OMGtoPS -in <infile> -out <outfile.ps>
-in <infile>: Input 8-bitOMG1(JHC_header) raster file.-out <outfile.ps>: Output Encapsulated PostScript file.
Algorithm
- Reads the
JHC_headerviajhc_read_header()to obtain image dimensions (width = xmax,height = ymax) and verifies thatdata_type == 1(8-bit unsigned byte). - Computes the aspect-ratio-preserving scaling factor (
scale = 400.0 / max(width, height)) and centers the bounding box on the page (xoffset,yoffset). - Writes an
EPSF-2.0header (%!PS-Adobe-2.0 EPSF-2.0,%%BoundingBox) and a PostScript procedure that supports both Level 2 (currentfile /ASCIIHexDecode filter) and Level 1 (readhexstring+image) interpreters. - Encodes each raster scanline in two-character hexadecimal format (
%02x, 36 bytes / 72 hex characters per line) followed byshowpageand%%Trailer.