Skip to main content
Skip table of contents

Mako Image Extract

Mako Image Extract

Mako Image Extract looks for images on every page of the specimen PDF (or other supported PDL) then dumps them as an image file.

Mako Image Extract v1.0.0.X

   makoimageextract [output.yyy] [parameter=setting] [parameter=setting] ...
 Where:              source file from which to extract pages, where xxx is pdf, xps, pxl (PCL/XL) or pcl (PCL5).
   output.yyy             file to write the output to, where yyy is png, jog or tif.
                             If no output file is declared, <input>.png is assumed.
   parameter=setting      one or more settings, described below.

   p[assword]=<password>  PDF password, if required to open the file.
   f[older]=yes|no        Create a folder to contain the output, named according to the output file name.</code></pre>

How it works

Images are not a node type in Mako. Instead you will find them inside image or masked brushes, which are then used as fills, strokes, or opacity (soft) masks used in bona-fide nodes (for example, but not limited to, paths or glyphs nodes).

The way an everyday plain image will be represented is to be put inside an IDOMImageBrush, which is then used as the fill on a rectangular path that defines the area the image occupies. To find them, Mako Image Extract begins by collecting all the nodes on the page that are paths:

CEDLVector<IDOMNodePtr> pathNodes;
page->getContent()->findChildrenOfType(eDOMPathNode, pathNodes, true);

It then examines each path node by getting its fill (with path->getFill()). If this is successful then the type of brush is determined by casting to an IDOMImageBrush and IDOMMaskedBrush:

IDOMImageBrushPtr imageBrush = edlobj2IDOMImageBrush(brush);
IDOMMaskedBrushPtr maskedBrush = edlobj2IDOMMaskedBrush(brush);

The result of the cast will be non-null if the cast succeeded. From here the image is retrieved with getImageSource(), with an additional step needed for a masked image. The image is then encoded for the requested image type and written to disk, in the case below to PNG:

IDOMPNGImage::encode(jawsMako, image, IOutputStream::createToFile(jawsMako, outputFilePath));

Useful sample code

  • Image brushes and how they are used in Mako

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.