Enum Scalr.Mode

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AUTOMATIC
      Used to indicate that the scaling implementation should calculate dimensions for the resultant image by looking at the image's orientation and generating proportional dimensions that best fit into the target width and height given See "Image Proportions" in the Scalr class description for more detail.
      BEST_FIT_BOTH
      Used to indicate that the scaling implementation should calculate dimensions for the largest image that fit within the bounding box, without cropping or distortion, retaining the original proportions.
      FIT_EXACT
      Used to fit the image to the exact dimensions given regardless of the image's proportions.
      FIT_TO_HEIGHT
      Used to indicate that the scaling implementation should calculate dimensions for the resultant image that best-fit within the given height, regardless of the orientation of the image.
      FIT_TO_WIDTH
      Used to indicate that the scaling implementation should calculate dimensions for the resultant image that best-fit within the given width, regardless of the orientation of the image.
    • Enum Constant Detail

      • AUTOMATIC

        public static final Scalr.Mode AUTOMATIC
        Used to indicate that the scaling implementation should calculate dimensions for the resultant image by looking at the image's orientation and generating proportional dimensions that best fit into the target width and height given See "Image Proportions" in the Scalr class description for more detail.
      • FIT_EXACT

        public static final Scalr.Mode FIT_EXACT
        Used to fit the image to the exact dimensions given regardless of the image's proportions. If the dimensions are not proportionally correct, this will introduce vertical or horizontal stretching to the image.

        It is recommended that you use one of the other FIT_TO modes or AUTOMATIC if you want the image to look correct, but if dimension-fitting is the #1 priority regardless of how it makes the image look, that is what this mode is for.

      • BEST_FIT_BOTH

        public static final Scalr.Mode BEST_FIT_BOTH
        Used to indicate that the scaling implementation should calculate dimensions for the largest image that fit within the bounding box, without cropping or distortion, retaining the original proportions.
      • FIT_TO_WIDTH

        public static final Scalr.Mode FIT_TO_WIDTH
        Used to indicate that the scaling implementation should calculate dimensions for the resultant image that best-fit within the given width, regardless of the orientation of the image.
      • FIT_TO_HEIGHT

        public static final Scalr.Mode FIT_TO_HEIGHT
        Used to indicate that the scaling implementation should calculate dimensions for the resultant image that best-fit within the given height, regardless of the orientation of the image.
    • Method Detail

      • values

        public static Scalr.Mode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Scalr.Mode c : Scalr.Mode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Scalr.Mode valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null