Skip to main content
Enum

ImageFit

How an image is resized to fit the requested width and height.

Values

  • CONTAIN

    Fit inside the box, preserving the aspect ratio. The result may be smaller than the box in one dimension.

  • COVER

    Fill the whole box, preserving the aspect ratio and cropping what does not fit.

  • CROP

    Like SCALE_DOWN for small images; larger images are cropped to fill the box.

  • PAD

    Fit inside the box, preserving the aspect ratio, and pad the rest of the box to its exact size.

  • SCALE_DOWN

    Like CONTAIN, but never enlarge an image that is already smaller than the box.

Used by