Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ImageUtil

Hierarchy

  • ImageUtil

Index

Methods

Static calculateAspectRatioFit

  • calculateAspectRatioFit(srcWidth: any, srcHeight: any, maxWidth: any, maxHeight: any): object
  • Conserve aspect ratio of the orignal region. Useful when shrinking/enlarging images to fit into a certain area.

    In most cases this is not needed as the object-fit:contain CSS will obtain the desired result.

    Parameters

    • srcWidth: any

      Source area width

    • srcHeight: any

      Source area height

    • maxWidth: any

      Fittable area maximum available width

    • maxHeight: any

      Fittable area maximum available height

    Returns object

    { width, heigth }

    • height: number
    • width: number

Generated using TypeDoc