Mako Samnai (マコサムネイル)
"Samnai" is Japanese for thumbnail, so Mako Samnai is a way to rasterize a PDF page. You can choose color, grayscale, or monochrome output, and for monochrome choose from a number of EDS (error diffusion screening) methods.
Mako Samnai v1.0.0.X
Usage:
Makosamnai input.pdf|xps|pxl|pcl [output.jpg|png|tiff|bmp] [parameter=setting] [parameter=setting] ...
Where:
input.pdf source PDF to render pages from, where xxx is pdf, xps, pxl (PCL/XL) or pcl (PCL5).
output.yyy image file to write the output to, where yyy is jpg, png, tiff or bmp.
If no output file is declared, <input>.png is assumed.
parameter=setting one or more settings, described below.
Parameters:
pw=<password> PDF 'User' password, if required to open the file.
p=<page range> One or more page ranges separated by a comma, eg p=1-10,5-30,92,600-720,40-50.
If no page ranges are declared, all pages are processed.
w=<width> Output size width in pixels, eg w=1700.
h=<height> Output size height in pixels, eg h=2200.
If width and height are both specified, height is ignored for non-BMP formats.
r=<resolution> Resolution in dpi, eg r=300. Default is 72.
Calculated value overrides resolution (r) when width (w) or height (h) are specified.
rx=<resolution> *For BMP output only* X-direction resolution in dpi, eg rx=600. Default is 72.
Ignored when resolution (r) or width (w) is specified.
ry=<resolution> *For BMP output only* Y-direction resolution in dpi, eg ry=400. Default is 72.
Ignored when resolution (r) or height (h) is specified.
f=<lpi> Frequency value for mono output spot function in lpi. Default is 60.
t=<threshold> Threshold percentage for bi-level output. Default is 50%.
so=on|off Simulate overprint. Default is off.
o=<render type> Output render type. Allowable values are:
coloraa (anti-aliased RGB. Default)
color (RGB, no anti-aliasing)
gray (grayscale, no anti-aliasing)
cmyk (CMYK, no anti-aliasing. Not available for BMP)
mono (monochrome using a simple 45° halftone spot)
bilevel (monochrome thresholded output, using t value)
e=<eds type> Apply an error diffusion screen. For BMP output only. Allowable values are:
atkins (Use an Atkinson error diffusion screen)
floyds (Use a Floyd-Steinberg error diffusion screen)
stucki (Use a Stucki error diffusion screen)
sierra (Use a Sierra error diffusion screen)
s-lite (Use a Sierra Lite error diffusion screen)
How it works
All of the rendering is carried out by the embedded Jaws RIP, using an instance of IJawsRenderer
. The BMP output makes use of render-to-buffer APIs added in Mako 4.4, which can be faster and allow for non-square resolutions (that is, the resolution in the x
-direction can be different from the y
-direction).
A rendered grayscale image can then be screened with an error diffusion algorithm. Five common methods are offered, including Floyd-Steinberg and Stucki.
Useful sample code
- Use of
IJawsRenderer
to render pages in a variety of ways - Using
IJawsRenderer::CThresholdHalftone
to create a threshold halftone - Using
IJawsRenderer::CSpotHalftone
to create a spot halftone - Use of an
IOptionalContentFixerTransform
to control rendering of optional content (PDF layers) - Use of an
IOverprintSimulationTransform
to simulate overprint, while dropping overprint for CMYK black text - Use of an EDS screening algorithm operating on the rendered image
- Use of the encode convenience method for writing an image file, eg
IDOMJPEGImage::encode
- Methods to encode as BMP (Mako does not support BMP as a standard format)
Examples of Makosamnai commands
Makosamnai test100.pdf | Produces 100 72dpi RGB PNG files with the filename test100_pX.png, where X is the page number. |
Makosamnai test100.pdf MyOutput.tif p=10-20 w=1000 | Produces 11 RGB TIFF files with the filename MyOutput_pX.tif with a width of 994 pixels. (Width may be adjusted down to ensure the effective resolution in an integer.) |
Makosamnai test100.pdf test100.bmp p=30-40 | Produces 11 RGB BMP files with a resolution of 72DPI |
Makosamnai altona_visual_1v2a_x3.pdf r=200 so=on | Produces a 200dpi PNG of this popular test file, with overprint simulation |