Package: mlreportgen.report
Captioned image reporter
Create a reporter for an image with a caption.
creates an empty image
reporter. Use the reporter properties to set the image source, caption, height, width,
and so on. The reporter uses a template to format and number the caption and position it
relative to the image. To customize the format, you can specify a custom template or
override the template programmatically, using the properties of this reporter.image
= FormalImage()
creates an image reporter that adds the image specified by the
image
= FormalImage(source
)source
to a report. See the Image
property.
sets properties using name-value pairs. You can specify multiple name-value pair
arguments in any order. Enclose each property name in single or double quotes.image
= FormalImage(Name,Value
)
createTemplate | Create formal image template |
customizeReporter | Create custom formal image reporter class |
getCaptionReporter | Get image caption reporter |
getClassFolder | Formal image class definition file location |
getImageReporter | Get formal image reporter |
Add an empty image reporter to a report and then, set its source, caption, and height.
import mlreportgen.report.* rpt = mlreportgen.report.Report('output','pdf'); chapter = mlreportgen.report.Chapter(); chapter.Title = 'Formal Image Reporter Example'; image = mlreportgen.report.FormalImage(); image.Image = which('ngc6543a.jpg'); image.Caption = 'Cat''s Eye Nebula or NGC 6543'; image.Height = '5in'; add(chapter,image); add(rpt,chapter); rptview(rpt);
Add an image to a report. Use default formatting, but change the text color of the caption to red.
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report('output','pdf'); chapter = Chapter(); chapter.Title = 'Formal Image Reporter Example'; image = FormalImage(); image.Image = which('ngc6543a.jpg'); text = Text('Cat''s Eye Nebula or NGC 6543'); text.Color = 'red'; image.Caption = text; add(chapter,image); add(rpt,chapter); rptview(rpt);
Add an image to a report and override its alignment, caption font, and margins
import mlreportgen.report.* import mlreportgen.dom.* rpt = Report('output','pdf'); chapter = Chapter(); chapter.Title = 'Formal Image Reporter Example'; image = FormalImage(); image.Image = which('ngc6543a.jpg'); image.Height = '5in'; para = Paragraph('System Design Description'); para.Style = {HAlign('left'),FontFamily('Arial'),... FontSize('12pt'),Color('white'),... BackgroundColor('blue'), ... OuterMargin('0in', '0in','.5in','1in')}; image.Caption = para; add(chapter,image); add(rpt,chapter); rptview(rpt);
Create an image map with a defined image area in the upper left and add that image to the report. If you click in the image area, it displays the web page associated with that area.
import mlreportgen.report.*; rpt = Report('test','pdf'); image = FormalImage(which('ngc6543a.jpg')); area = mlreportgen.dom.ImageArea('https://www.google.com',... 'Google',0,0,100, 100); map = mlreportgen.dom.ImageMap; append(map,area); image.Map = map; add(rpt,image); close(rpt); rptview(rpt);
mlreportgen.dom.Image
| mlreportgen.dom.ImageArea
| mlreportgen.dom.ImageMap
| mlreportgen.dom.LinkTarget
| mlreportgen.report.Report
| mlreportgen.report.Reporter