extract-images
Extracts a specified image resolution from an image container. It can also transform MathML images to PNG for Apache FOP.
In IXIA CCMS, multi-resolution images are assigned
a collective ID and stored in a zip file with the extension .image. This .image
container file is specific to CCMS and cannot be sent
directly to the transformation scenario. The extract-images
task lets you extract from this container the image
resolution that you need so that it can be processed by the transformation
scenario.
- It makes a backup copy of each image container (that is, it copies <id>.image to <id>.zip)
- It extracts from each container the image with the specified resolution (for example, HiRes, LowRes, etc.)
- It replaces the container file with the extracted image
- lar1369834664934_MedRes.png
- lar1369834664934_HiRes.png
After calling the extract-images
task and specifying the HiRes resolution, the lar1369834664934_HiRes.png file will be renamed lar1369834664934.image.
If the image container does not include an image with the specified resolution, the default resolution is used instead.
Converting MathML images to PNG (for FOP)
Syntax
<extract-images
indir="directory"
type="image_type"
extension=".image"/>
Parameters
Attribute | Description | Type | Required |
---|---|---|---|
indir | Input directory that contains the images to process. | String | Yes |
type | Type of images to process (for example, HiRes, MedRes, LowRes, etc.). Enter a resolution specified in multiimage.xml. | String | Yes |
extension | Extension of the image container file. | String | No. Default is ".image ". |
Contained elements
The extract-images task can also contain the following elements to convert MathML files to PNG before sending them to an FOP transformation scenario:
Element | Attribute | Description | Type | Required |
---|---|---|---|---|
<equation> |
||||
mime | MIME type of the image to transform; valid values
are:
|
String | Yes | |
ratio | Ratio used when converting the image. Enter a value
between 0 and 1. Note: Applies to MathML images only. This attribute is
ignored for SVG. |
String | No. Default is "1 ". |
|
One or more <param> elements |
The <equation> element can include one or more <param> elements, which provide a set of
name-value pairs to specify parameters
for the conversion. |
|||
name | For MathML, the parameter specified can be one of
the parameters supported by the Jeuclid library, as follows: http://jeuclid.sourceforge.net/jeuclid-core/apidocs/net/sourceforge/jeuclid/context/Parameter.html For example:
|
|||
value | As appropriate for the parameter name. |
Example
For example, the following code extracts all the high resolution images from the image containers found in the input directory specified.
<extract-images
indir="${outgen.job.source.dir}"
type="HiRes"
extension=".image"/>
The following code shows the extract_HiRes_images target, which uses the extract-images task with the <equation>
element. This target checks if the PDF formatter is
fop
; in this case, it extracts all the HiRes
images and converts the MathML files to PNG files. For all other formatters, it
simply extracts all the HiRes images.
<target name="extract_HiRes_images">
<!-- Will process the multiple images container. -->
<!-- If the image to extract is a MathML file
and the formatter is FOP, we need to generate a raster version
of the MathML otherwise FOP will throw errors for these images -->
<if>
<equals arg1="${outgen.job.default.pdf.formatter}" arg2="fop"/>
<then>
<extract-images indir="${outgen.job.source.dir}" type="HiRes" extension=".image">
<equation mime="application/mathml+xml" ratio="1">
<param name="debug" value="0"/>
</equation>
</extract-images>
</then>
<else>
<extract-images indir="${outgen.job.source.dir}" type="HiRes" extension=".image"/>
</else>
</if>
</target>