Changes between Version 9 and Version 10 of rp_xml_ele_image


Ignore:
Timestamp:
May 14, 2010, 7:21:04 PM (7 years ago)
Author:
mmc
Comment:

Fixed up explanation of new image stuff, including convert

Legend:

Unmodified
Added
Removed
Modified
  • rp_xml_ele_image

    v9 v10  
    11== <image> ==
    22
    3 An image object represents some photographic image.  On the input side, it can be used as a diagram for control values.  In that case, the image data is stored as a base64-encoded GIF, JPEG, or PNG image.  You can use your favorite language's equivalent '''Rappture::RpLibrary::putFile''' function to automatically load an image file into your Rappture library object or you can take advantage of the '''Rappture::encoding''' module to do the base64-encoding. Also, on Linux, you can use the '''{{{mimencode}}}''' program to convert a normal GIF/JPEG/PNG file to the proper encoding shown below:
     3An image object represents some photographic image.  On the input side, it should be treated as an input to an image manipulation algorithm.  Some older programs use this to display a diagram for control values, although it is better to use a [wiki:rp_xml_ele_note note] for that.  The image data is stored within the {{{<current>}}} tag as a base64-encoded GIF, JPEG, or PNG image.  You can use your favorite language's equivalent '''Rappture::RpLibrary::putFile''' function to automatically load an image file into your Rappture library object or you can take advantage of the '''Rappture::encoding''' module to do the base64-encoding. Also, on Linux, you can use the '''{{{base64}}}''' or '''{{{mimencode}}}''' program to convert a normal GIF/JPEG/PNG file to the proper encoding shown below:
    44
    55[[rpimage(zoo_image1.gif)]]
     
    1313  </image>
    1414}}}
    15 An image can have a label in the {{{<about>}}} section, although this example doesn't.
     15An image can have a label in the {{{<about>}}} section.  In that case, the actual image is scaled down to thumbnail size, and information about the image is presented to the right of it, as follows:
     16
     17[[rpimage(zoo_image4.gif)]]
    1618
    1719[[BR]]
    18 An image can also be produced as output.  In that case, the image appears in a viewer with controls for zooming in and out:
    19 
    20 [[rpimage(zoo_image2.gif)]]
    21 {{{
    22   <output>
    23     <image id="outi">
    24       <about>
    25         <label>Rotated Image</label>
    26       </about>
    27       <current>/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
    28 Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwh
    29 MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAAR
    30 ...
    31       </current>
    32     </image>
    33     ...
    34   </output>
    35 }}}
    36 
    37 [[BR]]
    38 Another option for image objects include <resize>. Users can resize an image by including this tag in the <image> object as shown in the examples below. If the <resize> parameter is set, then the image is resized. The "auto" value resizes to the current area.  The "width=XX" or "height=xx" form resizes to a particular size.  The "none" value leaves the image as-is; this is the default.
    39 
     20Another option for image objects is <resize>, which determines the size of the thumbnail presented.  Users can set the size of the preview thumbnail by including this tag in the <image> object as shown in the examples below. If the <resize> parameter is set, then the image is resized. The value "auto" or "none" resizes to a default 100x100 thumbnail.  The "width=XX" or "height=xx" form resizes to a particular size.
    4021
    4122{{{
     
    6142{{{
    6243  <image>
    63     <resize>auto</resize>
    64     <current>R0lGODlhtAA8APcAAFeBu////0VurKW829Ld7YSjzWKJwLzN5HmayfT3+unu9sfV6G2SxJqz1t3m
    65 8Y+r0rHE31aAus3Y6VJ5sEpysEdvrXeVwlV+uVB6tVZ/uEhwrlV/uEx1slN8t1eAuk50qFF4rlJ7
    66 tkZol5yy0092q0dqmVV+t053tElxr0VmlEVnlU92qlR8tFN7sk12s0VtrEVtqkRrpktvoUxxpEt0
    67 ...
    68     </current>
    69   </image>
    70 }}}
    71 {{{
    72   <image>
    7344    <resize>none</resize>
    7445    <current>R0lGODlhtAA8APcAAFeBu////0VurKW829Ld7YSjzWKJwLzN5HmayfT3+unu9sfV6G2SxJqz1t3m
     
    7950  </image>
    8051}}}
     52
     53[[BR]]
     54If the {{{<convert>}}} option is included, it specifies a format that the image should be converted to when passed to the underlying program.  For example, suppose the underlying program expects all images in GIF format.  If you add {{{<convert>gif</convert>}}} to your input specification, then all images will be passed along in GIF format, regardless of whether they were uploaded as PNG, JPEG, etc.  Use the {{{<convert>}}} tag in your input specification as follows:
     55
     56{{{
     57  <image>
     58    <about><label>Input image</label></about>
     59    <convert>gif</convert>
     60  </image>
     61}}}
     62
     63Other valid image formats for the {{{<convert>}}} tag are:  {{{bmp}}}, {{{gif}}}, {{{ico}}}, {{{jpeg}}}, {{{pcx}}}, {{{pixmap}}}, {{{png}}}, {{{pgm}}}, {{{ppm}}}, {{{ps}}}, {{{pdf}}}, {{{sgi}}}, {{{sun}}}, {{{tga}}}, {{{tiff}}}, {{{window}}}, {{{xbm}}}, {{{xpm}}}.
     64
     65[[BR]]
     66An image can also be produced as output.  In that case, the image appears in a viewer with controls for zooming in and out:
     67
     68[[rpimage(zoo_image2.gif)]]
     69{{{
     70  <output>
     71    <image id="outi">
     72      <about>
     73        <label>Rotated Image</label>
     74      </about>
     75      <current>/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
     76Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwh
     77MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAAR
     78...
     79      </current>
     80    </image>
     81    ...
     82  </output>
     83}}}
     84
     85
    8186
    8287You can also add a little html note to your image to help explain it's meaning: