public class Thumbnailer
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args) |
static java.awt.Image |
readImage(java.io.File infile) |
static java.awt.image.BufferedImage |
scaleImage(java.awt.Image image,
int width,
int height) |
static byte[] |
scaleUserGivenImageToConstraints(java.awt.image.BufferedImage image,
int maxWidth,
int maxHeight,
int maxLength)
Scales the provided BufferedImage to meet specified constraints and returns the result as a byte array.
|
static byte[] |
scaleUserGivenImageToConstraints(java.awt.image.BufferedImage image,
int maxWidth,
int maxHeight,
int maxLength,
java.lang.String imageFormat) |
static byte[] |
scaleUserGivenImageToConstraints(java.io.File infile,
int maxWidth,
int maxHeight,
int maxLength)
Returns the given image file as a byte array with the following policy:
- If the file is not an image, not found, or encounters any other problem, a runtime exception will be thrown
|
static void |
thumbnail(java.io.File infile,
java.io.File outfile,
int width,
int height,
float quality) |
static java.awt.image.BufferedImage |
thumbnail(java.awt.Image image,
int width,
int height,
float quality) |
static void |
thumbnail(java.lang.String infile,
java.lang.String outfile,
int width,
int height,
float quality) |
static void |
writeImage(java.awt.image.RenderedImage image,
java.io.File outfile,
float quality) |
static void |
writeImage(java.awt.image.RenderedImage image,
java.io.File outfile,
float quality,
java.lang.String imageFormat) |
static void |
writeImage(java.awt.image.RenderedImage image,
javax.imageio.stream.ImageOutputStream ios,
float quality) |
static void |
writeImage(java.awt.image.RenderedImage image,
javax.imageio.stream.ImageOutputStream ios,
float quality,
java.lang.String imageFormat) |
static void |
writeImage(java.awt.image.RenderedImage image,
java.io.OutputStream outstream,
float quality) |
static void |
writeImage(java.awt.image.RenderedImage image,
java.io.OutputStream outstream,
float quality,
java.lang.String imageFormat) |
public static void main(java.lang.String[] args)
public static void thumbnail(java.lang.String infile, java.lang.String outfile, int width, int height, float quality)
public static void thumbnail(java.io.File infile, java.io.File outfile, int width, int height, float quality)
public static java.awt.image.BufferedImage thumbnail(java.awt.Image image, int width, int height, float quality)
public static java.awt.Image readImage(java.io.File infile)
public static java.awt.image.BufferedImage scaleImage(java.awt.Image image, int width, int height)
public static void writeImage(java.awt.image.RenderedImage image, java.io.File outfile, float quality)
public static void writeImage(java.awt.image.RenderedImage image, java.io.File outfile, float quality, java.lang.String imageFormat)
public static void writeImage(java.awt.image.RenderedImage image, java.io.OutputStream outstream, float quality)
public static void writeImage(java.awt.image.RenderedImage image, java.io.OutputStream outstream, float quality, java.lang.String imageFormat)
public static void writeImage(java.awt.image.RenderedImage image, javax.imageio.stream.ImageOutputStream ios, float quality)
public static void writeImage(java.awt.image.RenderedImage image, javax.imageio.stream.ImageOutputStream ios, float quality, java.lang.String imageFormat)
public static byte[] scaleUserGivenImageToConstraints(java.io.File infile, int maxWidth, int maxHeight, int maxLength)
infile
- The input image file to be processed.maxWidth
- The maximum width allowed for the image.maxHeight
- The maximum height allowed for the image.maxLength
- The maximum length (file size) allowed for the image.java.lang.RuntimeException
- If the input file is not found, is not an image, or encounters other issues.public static byte[] scaleUserGivenImageToConstraints(java.awt.image.BufferedImage image, int maxWidth, int maxHeight, int maxLength)
image
- The input BufferedImage to be processed.maxWidth
- The maximum width allowed for the scaled image.maxHeight
- The maximum height allowed for the scaled image.maxLength
- The maximum size (in bytes) allowed for the resulting image.imageFormat
- The format in which the scaled image should be encoded (e.g., "jpeg", "png", "gif").
Defaults to "jpeg" if not specified.java.lang.IllegalArgumentException
- If the provided image format is not supported or any of the constraints
(maxWidth, maxHeight, maxLength) are invalid (e.g., negative values).public static byte[] scaleUserGivenImageToConstraints(java.awt.image.BufferedImage image, int maxWidth, int maxHeight, int maxLength, java.lang.String imageFormat)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.