ScaleImageConfig
Configration object for scaling images
Methods
getSupportedImageFormats
getSupportedImageFormats():
string[]
Provides a list of supported image formats. This depends on your JVM.
Returns
string[]a list of supported formats.
imageFormat
imageFormat(
pImageFormat):ScaleImageConfig
Convert image to a supported format. Null uses the format of the given image. Valid formats are "jpg", "bmp", "png" and other, depending on your JVM. Use "config.getSupportedImageFormats()" for a list of all supported formats.
Parameters
string | number | booleana String containing the informal name of the format.
Returns
ScaleImageConfigcurrent object
Throws
May throw an exception.
resizeMode
resizeMode(
pResizeMode):ScaleImageConfig
Defines the mode used für scaling the image. Valid modes are:
Parameters
string | number | booleana String containing the name of the mode.
Returns
ScaleImageConfigcurrent object
Throws
May throw an exception.
Example
"AUTOMATIC": Used to indicate that the scaled image should fit best into the target width and height given with preserving the image's proportions.
"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.
"FIT_TO_WIDTH": Used to indicate that the scaled image should fit best within the given width, regardless of the orientation of the image.
"FIT_TO_HEIGHT": Used to indicate that the scaled image should fit best within the given height, regardless of the orientation of the image.
Most of the time you just want to keep "AUTOMATIC" to "do the right thing".
scalingMethod
scalingMethod(
pScalingMethod):ScaleImageConfig
Defines the method used for scaling the image; preferring speed to quality or a balance of both. Valid modes are
Parameters
string | number | booleana String containing the name of the method.
Returns
ScaleImageConfigcurrent objet
Throws
May throw an exception.
Example
"AUTOMATIC": (default) Used to indicate that the scaling implementation should decide which method to use in order to get the best looking scaled image in the least amount of time.
By default the thresholds chosen will give nearly the best looking result in the fastest amount of time by choosing automatically QUALITY, BALANCED or SPEED.
"SPEED": Used to indicate that the scaling implementation should scale as fast as possible and return a result.
For smaller images (800px in size) this can result in noticeable aliasing but it can be a few magnitudes times faster than using the QUALITY method.
"BALANCED": Used to indicate that the scaling implementation should use a scaling operation balanced between SPEED and QUALITY.
Sometimes SPEED looks too low quality to be useful (e.g. text can become unreadable when scaled using SPEED) but using QUALITY mode will increase the processing time too much.
This mode provides a "better than SPEED" quality in a "less than QUALITY" amount of time.
"QUALITY": Used to indicate that the scaling implementation should do everything it can to create as nice of a result as possible.
This approach is most important for smaller pictures (800px or smaller) and less important for larger pictures as the difference between this method and the SPEED method become less noticeable as the source-image size increases.
Using the AUTOMATIC method will automatically prefer the QUALITY method when scaling an image down below 800px in size.
"ULTRA_QUALITY": Used to indicate that the scaling implementation should go above and beyond the work done by "QUALITY" to make the image look exceptionally good at the cost of more processing time.
This is especially evident when generating thumbnails of images that look jagged with some of the other modes
targetHeight
targetHeight(
pTargetHeight):ScaleImageConfig
Defines the target height that you wish the image to have
Parameters
numberthe height in pixel
Returns
ScaleImageConfigcurrent object
targetWidth
targetWidth(
pTargetWidth):ScaleImageConfig
Defines the target width that you wish the image to have
Parameters
numberthe width in pixel
Returns
ScaleImageConfigcurrent object