public double getDefaultImageQuality(String mimeType) {
    if (StringUtils.isNotEmpty(mimeType)) {
      String format = StringUtils.substringAfter(mimeType.toLowerCase(), "image/");
      if (StringUtils.equals(format, "jpg") || StringUtils.equals(format, "jpeg")) {
        return DEFAULT_JPEG_QUALITY;
      }
      else if (StringUtils.equals(format, "gif")) {
        return 256d; // 256 colors
      }
    }
    // return quality "1" for all other mime types
    return 1d;
  }
public double getDefaultImageQuality ( String mimeType ) { if ( StringUtils . isNotEmpty ( mimeType ) ) { String format = StringUtils . substringAfter ( mimeType . toLowerCase ( ) , "image/" ) ; if ( StringUtils . equals ( format , "jpg" ) || StringUtils . equals ( format , "jpeg" ) ) { return DEFAULT_JPEG_QUALITY ; } else if ( StringUtils . equals ( format , "gif" ) ) { return 256d ; } } return 1d ; }
Get the default quality for images in this app generated with the Layer API.
The meaning of the quality parameter for the different image formats is described in
{@link com.day.image.Layer#write(String, double, java.io.OutputStream)}.
@param mimeType MIME-type of the output format
@return Quality factor