ImageSize

ImageSize

is an option that specifies the overall size of an image to display for an object.

Details

  • The following settings can be given:
  • wwidth specified by w
    UpTo[s]maximum width and height specified by s
    {w,h}explicit width and height
    {UpTo[wmax],UpTo[hmax]}width and height maximums
    {{wmin,wmax},{hmin,hmax}}width and height ranges
  • Specifications for both width and height can be any of the following:
  • Automaticdetermined by location or other dimension (default)
    Tiny, Small, Medium, Largepredefined absolute sizes
    dd printer's points (before magnification)
    72didi inches (before magnification)
    Fullfill out the enclosing region
    Scaled[s]a fraction s of the enclosing region
    Allsize that fits all objects in a collection
  • With ImageSize->{w,h}, an object will always be drawn in a w×h region and will be sized to fit in the region.
  • If the object has a definite aspect ratio that is not h/w, then space will be left around it.
  • The position of the object within the w×h region is determined by the setting for the object's Alignment option.
  • With ImageSize->{UpTo[wmax],UpTo[hmax]}, an object is sized so that its width and height are as large as possible while not exceeding the specified maximums.
  • No extra space is then left around the object, so that the region in which the object is drawn is always the same shape as the object itself.
  • ImageSizeUpTo[s] is equivalent to ImageSize->{UpTo[s],UpTo[s]}.
  • With ImageSize->{{wmin,wmax},{hmin,hmax}}, the object is sized to be as large as possible while not exceeding specified maximums, with extra space being left if necessary in order to satisfy the minimums.
  • ImageSize->{{smin,smax}} is equivalent to ImageSize->{{smin,smax},{smin,smax}}.
  • Objects maintain a fixed aspect ratio when resized by ImageSize specifications, except when the objects have AspectRatio->Full.
  • ImageSize->w is equivalent to ImageSize->{w,Automatic}.
  • ImageSize->{Automatic,h} normally determines image size from height, with width left unconstrained.
  • Symbolic settings such as ImageSize->Small define width and height maximums, with no extra space being left.
  • For an object that appears directly in a notebook cell, ImageSize->Full corresponds to the full width of the content area for the cell.
  • When the cell is printed, ImageSize->Full corresponds to the full width of the content area of the page.
  • For an object that appears as an element in a Grid, ImageSize->Full corresponds to the full width of the cell in the grid.
  • ImageSize is an option not only for Graphics, but also for objects such as Slider, Button, Pane, and Grid. ImageSize is also an option for Export.
  • Settings such as Automatic and Small yield different image sizes for different objects.
  • For constructs such as SlideView, TabView, or Toggler, ImageSize->All specifies that a fixed image size should be used that fits all possible elements that can be displayed. ImageSize->Automatic specifies that the image size should be determined by the currently displayed element.
  • ImageSize->All by default refers to both width and height; ImageSize->{Automatic,All} leaves enough vertical space for all images, but adjusts horizontal space separately for each image.
  • For a graphic with ImageSize->Automatic that appears directly in a notebook cell, the image size is determined by the ImageSize setting for the style of the cell.
  • Graphics with ImageSize->Automatic are rendered smaller when they appear in lists or grids, and even smaller when they appear in textlike constructs.
  • Some settings of BaselinePosition are incompatible with the Full and Scaled settings of the vertical dimension of ImageSize. When these settings conflict, the BaselinePosition setting will supercede the ImageSize setting.

Background & Context

  • ImageSize is an option to many graphics and visualization functions that specifies the overall size at which to display a plot, graphic, or image. Common functions that allow ImageSize specification include image functions such as Image and Image3D; Graphics and Graphics3D expressions; plotting functions such as Plot, ParametricPlot, ContourPlot, and RegionPlot; Graph expressions; as well as many others. ImageSize->Automatic uses a size that is generally appropriate for a given function and is the usual default value.
  • ImageSize supports a number of specification syntaxes, including explicit width, width and height, maximum width and height, and symbolic specifications such as Automatic, Small, Medium, Large, Full, Scaled[s], and All. Image size values given as explicit numbers are assumed to specify the size in units of points.
  • Other useful options that may be specified for images and graphics include ImageMargins, Magnification and ImageResolution. The size of an image or graphic expression may be changed using Image[image,ImageSize->x] or Show[graphics,ImageSize->x].
  • While ImageSize changes the display size of an image (on the screen), it does not affect the underlying dimensions (as reported by ImageDimensions). Functions useful for changing the actual dimensions of an Image object include ImageResize, ImageCrop, ImageTrim, and ImagePad.

Examples

open allclose all

Basic Examples  (5)

Use predefined symbolic sizes:

Use an explicit image width:

Use an explicit image width and height:

Use a size proportional to the enclosing area:

Specify the sizes of controls:

Scope  (3)

Use predefined symbolic sizes in 3D:

Prevent the height and the width from exceeding 100 points:

Use a fraction of the enclosing region:

Applications  (1)

A wide range of aspect ratios with bounded image size:

Possible Issues  (1)

With ImageSize->Automatic, images may appear larger or smaller than their actual size:

Use ImageSize->All to see images in their actual size:

Wolfram Research (1996), ImageSize, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageSize.html (updated 2017).

Text

Wolfram Research (1996), ImageSize, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageSize.html (updated 2017).

CMS

Wolfram Language. 1996. "ImageSize." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/ImageSize.html.

APA

Wolfram Language. (1996). ImageSize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageSize.html

BibTeX

@misc{reference.wolfram_2024_imagesize, author="Wolfram Research", title="{ImageSize}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/ImageSize.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagesize, organization={Wolfram Research}, title={ImageSize}, year={2017}, url={https://reference.wolfram.com/language/ref/ImageSize.html}, note=[Accessed: 21-November-2024 ]}