Previous: ISL Data and Displays Next: Writing Text Files Table of contents Images Frames Unidata's Integrated Data Viewer > Miscellaneous > IDV Scripting

7.1.4 ISL Images and Movies
The image and movie tag are the ones used to create images and movies. Both of these tags can contain subtags that allow you to manipulate the image or images.
<image> Generate and manipulate images
<image
    file="image file, e.g., gif, png or jpg"
    quality="image quality, 0.0-1.0"
    view="view name or names to match"
    display="display id"
    what="what part of the display control should be captured" >

The image tag allows you to capture an image from a main display or from the GUI of a display control.

The file attribute defines the image file. For image formats that support it you can also specify a quality attribute that can range from close to 0.0(worst) to 1.0 (best and default).

The view attribute allows you to specify a name of a view it use. This can also be a regular expression pattern to use to match on multiple views. If there are multiple views in existence and there is no view attribute specified or if there multiple views resulting from a view name attribute you should use the viewindex and viewname in your filenames, etc., The viewindex property is the number of the view, e.g., the first view we capture has viewindex of 0, the second viewindex = 1, etc.

The display attribute allows you to specify a display control to use to capture. For its use see here. The what attribute allows you to specify what part of the display control gui should be captured. For now the IDV only supports what="chart" to capture the time series chart of the station model and data probe displays.


<movie> Create a Quicktime movie, animated GIF or Google Earth KMZ file
<movie
    file="movie file"
    view="view name or names to match"
    imagedir="The directory to place the images."
    imagetemplate="The file name template to use"
    imagesuffix="Should be jpg if generating a QuickTime movie but can be gif or png as well" >

The movie tag allows you to capture a time animation as a Quicktime movie, Google Earth KMZ file or as an animated gif.

The view attribute is the same as in the image tag.

If the file ends with .mov then a Quicktime movie is created. If the file ends with .gif then an animated gif is created. If the file ends with .kmz then a Google Earth KMZ file is created each being time stamped. Note: The file attribute can be a comma separated list of files, e.g.:

<movie file="test.mov,test.kmz,test.gif"/>
This allows you to capture mutiple types of movie products in one call.

If no file attribute is specified then this just generates the images, not the movie. For example, you can not specify the file name but do specify the imagedir and this will generate the images and place them in the imagedir for later processing.

The imagetemplate is a template filename that can contain text and three different macros, e.g.:

imagetemplate="image_%time%"    Include the animation time formatted in the default format
imagetemplate="image_%count%"   Include which image
imagetemplate="image_%count%_%time:any date format%"  Include animation time in any date format. e.g.:
imagetemplate="image_%count%_%time:yyyyMMddHHmm%"
The generic date format can contain a specification that is used by the Java SimpleDateFormat and is described in Basic Tags.

KML Attributes

The movie tag also supports a set of KML specific attributes that allow you to configure the generated KML file.

      <movie
         file="test.kmz"
         kml_desc="<a href="${wwwroot}/${bundle}">Run in the IDV</a> (Needs Java Webstart)"
         kml_name="${label}"
         kml_visibility="0"
         kml_open="0">

Using your own images

You can also use any number of contained fileset tags to define a custom list of images that are used instead of the default images derived from an animation capture.

<movie file="test.mov">
   <fileset file="image1.png"/>
   <fileset file="image2.png"/>
   <fileset file="image3.png"/>
</movie>

<panel> Create a gridded layout of a set of images. This is just like the movie tag and support all of the above attributes
<panel
    file="output image file"
    movieattributes="All of the movie tag attributes"
    columns="Number of columns"
    width="Resize the images to width"
    space="Spacing between each grid cell" >

The panel tag acts just like the movie tag except that it merges all of the images into one image in a panelized or gridded fashion. It is column oriented so you specify the number of columns:

<panel file="test.gif" width="400" columns="2" space="10"/>

<html> Create an image from rendered html
<html
    file="output image file"
    fromfile="Optional name of file to read in html"
    width="Fixed width of image" >

The html tag allows you to specify html that is rendered into an image. It acts just like the image tag in that in can contain image manipulation commands. The html is either from a file (specified by the fromfile attribute) or contained in a CDATA block:

<html file="foo.png">
   <![CDATA[
hello there
<hr>
This is my test
]]>
   <matte bottom="50" background="red"/>
</html>
Images Manipulation
There are a set of tags that can be contained by both the image and movie tags that support processing of the image. Most of these tags work on the initial image and act as a filter pipeline. For example, the ISL:
<image file="test.png">
    <clip north="40" south="30" east="-80" west="-90"/>
    <matte bottom="150"/>
</image>
Will generate an image from the main display. It will then clip the image at the given lat/lon bounding box and then add a matte with spacing of 150 pixels at the bottom of the image. It will then write out the image to the file test.png.

You can modify this behavior in a variety of ways. For example, the ISL:

<image file="test.png">
    <clip north="40" south="30" east="-80" west="-90" copy="true" file="clippedimage.gif"/>
    <matte bottom="150"/>
</image>
will clip the original image but not alter it (the copy="true") and then will write out the clipped image to the given file. The original image will be passed to the matte tag which will matte it.

The image manipulation tags can be nested. e.g. the ISL:

<image file="test.png">
    <clip north="40" south="30" east="-80" west="-90" copy="true" file="clippedimage.gif">
        <matte bottom="150"/>
        <write file="somefile.jpg"/>
        <transparent color="black"/>
    </clip>
    <matte bottom="150"/>
</image>
Will clip a copy of the image, matte the copy, write out the matted image as somefile.jpg, set the color black to be transparent and then write it out as clippedimage.gif. The original image is then matted and written out as test.png.
<clip> Clip an image
<clip
    north="latitude"
    south="latitude"
    east="longitude"
    west="longitude"
    top="pixels or %"
    bottom="pixels or %"
    left="pixels or %"
    right="pixels or %"
    display="The id of a display which we use its data's map projection to clip with" >

The clip tag allows you to clip the image. The clipping can either be defined in lat/lon coordinates, with x/y image coordinates or from the projection used from a display. The image coordinates can be specified as percentages.

Clip in image space:
<clip top="10" bottom="0" left="10%" right="0"/>

Clip in lat/lon space:
<clip north="40" south="30" east="-80" west="-90"/>
If there is a display attribute defined then we get the lat/lon bounds of its data to clip with. Use the display control Properties dialog to set the id that you reference in the ISL.
Clip using a display id:
<clip display="displayid"/>

<matte> Matte an image
<matte
    background="color name or r,g,b"
    top="pixel spacing"
    bottom="pixel spacing"
    left="pixel spacing"
    right="pixel spacing"
    space="pixel spacing"
    hspace="pixel spacing"
    vspace="pixel spacing" >

The matte tag allows you to add a space around any of the sides of an image. e.g:

<matte top="100" bottom="20"/>
You can also simply specify a space, hspace (horizontal space), or vspace (vertical space) attributes:
<matte space="10"/>

<matte hspace="20"/>

<matte vspace="20"/>
You can also specify a background color. The color can be a named color or a comma separated list of red/green/blue values:
<matte top="100"  background="black"/>
or:
<matte top="100"  background="red,green,blue values"/>

<overlay> Annotate an image with text or a logo
<overlay
    image="file or url to image"
    text="text to draw"
    place="rectangle point on base image"
    anchor="rectangle point on overlay"
    fontsize="font size for text"
    fontface="font face for text"
    color="color for text" >

The overlay tag allows you to add an icon or text as an image overlay. You can either specify and image or text. The place and anchor tags specify the location of the overlay. They take the form: "rectpoint,offsetx,offsety" Where rectpoint is a point on a rectangle:

   UL    UM    UR
   ML    MM    MR
   LL    LM    LR
   Where U=upper,M=middle,L=lower
   R=right,L=left
The offsetx and offsety are optional. The idea is you define a point on the base image, e.g., the upper left corner ("ul"). Then you define an anchor point on the overlay that will be placed at the place point. So for example, if you wanted the upper left corner of the image overlay to be drawn 10 pixels right and 20 pixels below the upper left corner of the base image then you would do:
   place="UL,10,20" anchor="UL"
If you wanted some text overlay to be placed so that its bottom center was in the middle of the image, 30 pixels from the bottom of the image you do:
   place="LM,0,-30" anchor="LM"
If you wanted some overlay to be placed so that its upper right was placed at the center of the image you do:
   place="M" anchor="UR"

<resize> Resize an image
<resize
    width="pixels or percent"
    height="pixels or percent" >

The resize tag allows you to resize an image. You specify either a width or a height:

<resize width="200"/>

<resize height="150"/>
The width or height can also be a percentage:
<resize width="50%"/>

<resize height="10%"/>

<thumbnail> Generate a thumbnail of an image
<thumbnail
    file="image file name"
    width="pixels or percent"
    height="pixels or percent" >

The thumbnail tag is just like the resize tag except that it will also write out the image. e.g:

<thumbnail width="50%" file="thumbnail.png"/>

<write> Write out an image
<write
    file="file to write to" >

The write tag allows you to write out an intermediate image file at any time.

    <write file="somefile.png"/>

<colorbar> Add a color bar to an image
<colorbar
    display="optional id of display to use. If not defined then this will use all colorbars found"
    width="bar width"
    height="bar height"
    orientation="tick mark location, 'right', 'left', 'bottom', 'top'"
    tickmarks="number of tick marks"
    interval="interval value"
    values="comma separated list of values"
    place="rectangle location"
    anchor="rectangle location"
    showlines="'true' or 'false', draw tick lines"
    linecolor="line color" >

The colorbar tag allows you to add a color bar from the color tables in the display controls. Currently, it does not do a perfect job when there are more than one color tables present.

The orientation attribute specifies where the tick marks are drawn, e.g., to the left, right, top or bottom of the color bar. This also implicitly specifies the horizontal (top, bottom) or vertical (right, left) orientation of the color bar. Note, placing a vertical color bar is a bit tricky.

You can specify how ticks are drawn. You can give a number of tickmarks, a value interval or a specific list of values.

The location of the color bar is defined using the anchor and place points as described for the overlay tag.

Here is an example that loads a bundle, creates an image, mattes the image and then shows the color bar of a display with id "planview".

<?xml version="1.0" encoding="ISO-8859-1"?>
<isl debug="true" loop="1" offscreen="true" sleep="60.0minutes">
  <bundle clear="true" file="${islpath}/colorbar.xidv" wait="true"/>
  <image file="${islpath}/colorbar.png">
     <matte space="100" background="gray"/>
     <colorbar display="planview" orientation="top" tickmarks="3" width="400" showlines="true"  anchor="LM" place="UM,0,100" showunit="true"/>
     <colorbar display="planview" orientation="bottom" tickmarks="3" width="400" showlines="true"  anchor="UM" place="LM,0,-100" showunit="true"/>
     <colorbar display="planview" orientation="top" tickmarks="3" width="400" showlines="true"  anchor="LM" place="LM" showunit="true"/>
     <colorbar display="planview" orientation="left" tickmarks="3" width="20" height="400" showlines="true"  anchor="MR" place="ML,100,0" showunit="true"/>
     <colorbar display="planview" orientation="left" tickmarks="3" width="20" height="400" showlines="true"  anchor="MR" place="MR" showunit="true"/>
  </image>
</isl>
colorbar.isl
That makes:
images/colorbar.png

<transparent> Set transparency on an image
<transparent
    color="color to set to transparent" >

The transparent tag allows you to set a particular color in an image to be transparent.

<transparent color="black"/>
or:
<transparent color="red,green,blue"/>

<split> Split an image into sub-images
<split
    file="base file name"
    columns="number of columns"
    rows="number of rows" >

The split tag splits up an image by a given number of rows and columns. The file attribute should contain properties for each image: ${row}, ${column} and ${count}.

 


Previous: ISL Data and Displays Next: Writing Text Files Table of contents Images Frames Unidata's Integrated Data Viewer > Miscellaneous > IDV Scripting