Image - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DocumentTools[Layout]

  

Image

  

generate XML for a Image element

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Image( img, opts )

Parameters

img

-

content for the Image element, as either a file name or a numeric Array image as used with the ImageTools package

opts

-

(optional) ; one or more keyword options as described below

Options

• 

captionalignment : identical(left,center,right):=left Indicates how the caption is horizontally aligned.

• 

captionposition : identical(below,above):=below Indicates whether the caption is positioned below or above the image.

• 

drawcaption : truefalse:=false Indicates whether the caption will be shown. The form of the caption is automatically generated and numbered by the interface upon display.

• 

height : posint:=200 ; The height in pixels to be used. If img specifies a filename then by default the height used is 200. If img is an Array then by default the first dimension's size is used as the height.

• 

width : posint:=200 ; The width in pixels to be used. If img specifies a filename then by default the width used is 200. If img is an Array then by default the second dimension's size is used as the width.

Description

• 

The Image command in the Layout Constructors package returns an XML function call which represents a Image element of a worksheet.

• 

The generated XML may be used with the results of other commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document may be inserted into the current document using the InsertContent command.

Examples

withDocumentTools:

withDocumentTools:-Layout:

This example uses an Array with a single 2-dimensional layer for a grayscale image.

AArray1..20,1..20,i,jevalhfargumentsini25+Ij102,datatype=float8:imgImageTools:-FitIntensityA

Executing the Image command produces a function call, in which the supplied image has been encoded.

gImageA,height=150,width=150

g_XML_Imagecaptionalignment=1,captionposition=1,drawcaption=false,height=150,width=150,zoomable=false,TUZOV3RLVWI8b2I8Uj1NRExDZE5CP0o+SjpcXFRrRW5iazphTlxcQE5kXFxrZUhQVEhQajxQdnl5eXl4YVl5YWFLaj1ycmhrW3lRPXl5eXhRWHVtV3hrSlxcVnJ5Sz90a0tgclJ0eV08bWptTE1cXG0/YEpqUEtcXFxceFpcXHM7cW9MVG9aTFJ1TGx4bVY+QG5DYE51XFxsP2BuTFlTRT1rV0htS0hqO0hMUz1sPWhrQ0hMPGlWRmlWWj1Wcnl5aXl0YVh5YUhMTGFraUVOO2B4ZEFUa0xsWlxcdUhdTj1ATGhhbkp5UkJNdTt2cj5GX2ZpXFxLcVtRXFw6RmM/b2M+b288P2Y8Mzw=

(1)

By using additional commands from the Layout Constructors package a nested function call can be produced which represents an entire worksheet.

xmlWorksheetGroupInputTextfieldg:

That XML representation of a worksheet can be inserted directly.

InsertContentxml:

A color image can also be supplied. The next example uses an Array with three 2-dimensional layers for a color image. The first layer initially represents the Hue layer in HSV colorspace, and the Array is recomputed in the RGB colorspace before being passed to the Image element constructor.

By default the dimensions of the Array are used to determine the height and width of the Image.

AArray1..200,1..100,i,jevalhfargumentsini205+Ij5010,datatype=float8:AImageTools:-FitIntensityA360:imgArray1..200,1..100,1..3,1.0,datatype=float8:img..,..,1A:imgImageTools:-HSVtoRGBimg:gImageimg:

InsertContentWorksheetGroupInputTextfieldg:

The image may also be specified with a file name, as a string.

imgcatkerneloptsdatadir,/images/antennas.jpg:

gImageimg:InsertContentWorksheetGroupInputTextfieldg:

The height and width options can be used to control the displayed dimensions of the Image.

gImageimg,height=150,width=300:InsertContentWorksheetGroupInputTextfieldg:

img2catkerneloptsdatadir,/images/undercarriage.jpg:A2ImageTools:-Readimg2:h,wceilImageTools:-HeightA22,ceilImageTools:-WidthA22

h,w200,300

(2)

gImageimg2,height=h,width=w:

InsertContentWorksheetGroupInputTextfieldg:

An Image element can also be used as the content of a Table cell.

gImagecatkerneloptsdatadir,/images/antennas.jpg:TTableRowg,g,exterior=none,interior=none,alignment=center:InsertContentWorksheetT:

Note that Table cells' contents are automatically rescaled, on display, to fit the cell width. In this next example the Table is specified to have a width of 25 percent of the visible worksheet.

g1Imagecatkerneloptsdatadir,/images/antennas.jpg:

g2Imagecatkerneloptsdatadir,/images/lichtenstein.jpg:

TTableRowg1,g2,RowSome text.,InlinePlotplotsin,alignment=center,Rowg2,g1,width=25,alignment=center:InsertContentWorksheetT:

Some text.

A numbered caption can be used.

gImageimg,drawcaption:InsertContentWorksheetGroupInputTextfieldg:

The caption position is optional.

gImageimg,drawcaption,captionposition=above,captionalignment=left:InsertContentWorksheetGroupInputTextfieldg:

Compatibility

• 

The DocumentTools:-Layout:-Image command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

See Also

Array

Component Constructors

DocumentTools

Embed

ImageTools

InsertContent

Layout Constructors

Table

XMLTools