Currently, Thumbnailator does not require setting the BufferedImage type and will (attempt to) use the types as the input source. (More specifically, the image type that is used by the Image I/O ImageReader implementation used for the image.) This means that the type can differ depending on the image type or the image itself.
By requiring the output type to be a certain type, the inconsistencies can be eliminated and also could avoid issues like "wrong colors in JPEG" issue that stems from handing a BufferedImage with an alpha channel to the default JPEG writer shipped with Java.
Also consider limiting the use of imageType method to only use with methods that output BufferedImage(s) like asBufferedImage.
Currently, Thumbnailator does not require setting the
BufferedImage
type and will (attempt to) use the types as the input source. (More specifically, the image type that is used by the Image I/OImageReader
implementation used for the image.) This means that the type can differ depending on the image type or the image itself.By requiring the output type to be a certain type, the inconsistencies can be eliminated and also could avoid issues like "wrong colors in JPEG" issue that stems from handing a
BufferedImage
with an alpha channel to the default JPEG writer shipped with Java.Also consider limiting the use of
imageType
method to only use with methods that outputBufferedImage
(s) likeasBufferedImage
.