Prints the image to a file or the printer.
print_image([id]) print_image([id,] filename) print_image([id,] filename, attributes) print_image([id,] attributes)
The function arguments.
|id||A ChipsId structure identifying the item.|
|filename||If a recognized suffix is included in the filename - namely ".png", ".jpg", or ".jpeg" - then the corresponding format will be used, otherwise the format attribute will be used.|
|attributes||Configure object properties by giving an attribute string (a space-separated list of key=value pairs), list, dictionary, or a ChIPS object.|
The print_image command prints the image only to either a file (if "filename" is specified) or the printer. To print the image with the colorbar, labels, etc., use the print_window command.
ChIPS can create image files in JPEG and PNG format. There are three ways to specify the output format:
- Including the format as a suffix on the filename: "plot.png", "plot.jpg", or"plot.jpeg".
- Setting the "format" attribute when you call print_image().
- Setting the "export.format" preference before you call print_image().
The list above is given in the order that the format is checked for, so
chips> print_image("plot.png", ["format", "jpg"])
will create a PNG format file called "plot.png", and not a JPG image.
If a filename is given with a suffix that is not recognized, then the output format will be taken from either the format attribute or the export.format preference setting.
Setting the output size
The pageunits attribute must be set to "pixels" in order to print images; any other value will result in an error. The pagewidth and pageheight values should be set to the desired pixel dimensions, e.g. 500x500.
The scalewidth and scaleheight attributes scale the image with regard to the print area, i.e. the pagewidth/pageheight specification. If the image is scaled such that it's larger than the page and "keepaspect" is set to false, the image is clipped. If "keepaspect" is "true", the scaled image maintains the original aspect ratio and is scaled up until one dimension touches the margins.
Please see the section "Export Preferences" below the examples for a list of the export preferences.
The contents of the current image are sent to the default printer.
A JPEG version of the current image is created in the file plot.jpeg.
chips> print_image("plot.png", "export.pageunits=pixels export.pagewidth=250 export.pageheight=250")
A postscript version of the current image is created in the file plot.ps; it has been re-sized to fill a US letter page. The second call to print_image creates a PNG format of the image in the file plot.png; the size of this file is determined by the size of the image being printed, since the pagesize, pagewidth, and fittopage options are only valid for the postscript and PDF outputs.
chips> add_image("img.fits", "id=FirstImage") chips> add_image("img2.fits", "id=Image2") chips> id.image = "FirstImage" chips> id = ChipsId() chips> print_image(id)
Two images are created; the second image is current after it is created. The id.image command sets the image value of the ChipsId structure to the first image, which is then sent directly to the user's default printer.
The attributes associated with export are given in the following table. All values can be changed using the print_window() command. To change the export preference settings prepend "export." to the attribute name.
|bottommargin||size of the bottom margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
|clobber||Overwrite an existing file?||see the Booleans section of "ahelp chipsopt"||false|
|colorscheme||indicates the color specification scheme||rgb|cmyk|cmyksep|greyscale|grayscale||rgb|
|dpi||What resolution should be used when displaying images, in dots per inch.||Non-negative integer||150|
|fittopage||Fits the image to the page size; aspect ratio is controlled by the "keepaspect" attribute||see the Booleans section of "ahelp chipsopt"||false|
|fonts||should the font be written to the printer, if the image is going to the printer||see the Booleans section of "ahelp chipsopt"||true|
|format (only used if not included as part of the file name)||export file format||ps|eps|pdf|png|jpg|jpeg||ps|
|keepaspect||Maintain aspect ratio of the image while fitting to the page?||see the Booleans section of "ahelp chipsopt"||true|
|leftmargin||size of the left margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
|orientation||page layout orientation||landscape|portrait||portrait|
|pageheight||height of the saved file image (PS and PDF formats only). This value overrides the window dimensions, and the units are taken from the window.units setting unless overridden by export.pageunits||numerical value||0.0|
|pagesize||print size (PS and PDF formats only)||letter|legal|executive|A3|A4|A5||letter|
|pageunits||Units of measure of the pagesize (PS and PDF formats only)||inches|cm|mm|pixels||inches|
|pagewidth||width of the saved file image (PS and PDF formats only). This value overrides the window dimensions, and the units taken from the window.units setting unless overridden by export.pageunits||numerical value||0.0|
|printdialog||if true, ChIPS will open a GUI for selecting the export option when print_window is called||see the Booleans section of "ahelp chipsopt"||false|
|printmethod||This setting is to support users with ATI Gallium display drivers who see displays being flipped by print_window. In this case, change the preference to xoffscreen.||One of framebuffer, xoffscreen, or none.||framebuffer|
|rightmargin||size of the right margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
|scaleheight||Factor for scaling the height value||Floating point percentage value||0.0|
|scalewidth||Factor for scaling the width value||Floating point percentage value||0.0|
|topmargin||size of the top margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.
- chips_helix, imextent
- add_image, current_image, delete_image, display_image, get_image, hide_image, load_colormap, remove_image_channel, set_image, shuffle_image