This release addresses the following issue:
This release addresses the following issue:
This release addresses the following issue:
This release fixes a performance issue introduced in 0.4.16. Unnecessary calls to Arrays.toString
in debug logging calls were removed.
The performance impact from the problem in 0.4.16 was negligible (less than 0.5%) in simulated workloads. Therefore, the impact of this fix is reducing unnecessary object allocation.
Thumbnailator 0.4.16 (January 2, 2022)This release addresses the following issue:
Issue 108 - Added workaround to properly orient thumbnails for JPEGs where Exif is the first non-SOI marker segment when using the default JPEG reader. The default JPEG reader included in Java cannot retrieve Exif from JPEGs where APP1 marker segment (like Exif) comes before the APP0 marker segment.
This workaround can be disabled by setting the system property thumbnailator.disableExifWorkaround
to true
.
This release addresses the following issues:
Issue 156 - Fixed issue with PNG file sizes being larger in Java 9 or later. Java 9 has changed the behavior the default PNG image writer to use a lower compression level. A workaround has been added to keep the same compression level as Java 8 and prior.
Issue 175 - Fixed issue with Javadocs failing to build in Java 8 or later.
Issue 162 - Added ability to configure insets of the watermark. This is convenient when offsetting the watermark from the corner of the thumbnail.
Insets can be specified through the .watermark(Position, BufferedImage, float, int)
method:
// Position watermark so that the bottom-right corner is five pixels away
// from the bottom-right corner of the thumbnail.
Thumbnails.of("path/to/image")
.size(100, 100)
.watermark(Positions.BOTTOM_RIGHT, watermarkImage, 0.5f, 5)
.toFile("path/to/thumbnail");
FileImageSink
class, pointed out in this comment.This release addresses the following issues:
Issue 157 - Fixed a bug that caused unexpected BufferedImage
image types. A few image filters (e.g. used through the .rotate
and Exif-based rotations) were corrected.
This fix may introduce unexpected behavior changes in existing code. While regression tests did not detect any issues, some caution is advised when switching to this version.
The original issue was caused by certain image filters changing the BufferedImage
image type to BufferedImage.TYPE_INT_ARGB
. If an issue is encountered, using .imageType(BufferedImage.TYPE_INT_ARGB)
may restore the behavior prior to this version.
Issue 161 - Fixed a division-by-zero bug when engaging memory conservation mode with thumbnailator.conserveMemoryWorkaround
.
This release addresses the following issues:
InputStream
) when an exception occurs while opening source files and streams.This release addresses the following issues:
FileInputStream
) when opening source files.This release addresses the following issues:
FileOutputStream
) when writing thumbnails to files.This release addresses the following issues:
Issue 107 - Fixed problem with Java2D rendering hints not being applied to progressive bilinear resizing, when image could be resized in one step.
Issue 118 - Fixed incorrect IFD Type for SRATIONAL
in the Exif reader.
Fixed bug where unused output files were being created.
Files which were going to be rejected at the output step (due to being a file format that isn't supported) were being created before the output step. This left behind files which should have not been created.
This release is a very minor update which includes a workaround to attempt to reduce the likeliness of OutOfMemoryError
s from occurring. (Refer to the "OutOfMemoryError
Workaround" section for details.)
In addition, the build tooling for Thumbnailator has been changed from Ant to Maven. (Issue 68) This has necessitated major re-arrangement of source files to conform with the Maven project layout.
Other minor changes include updating an out-of-date comment about implementation in the Thumbnailator
class (Issue 68) and added line number information to the Thumbnailator JAR file to assist in debugging. (Issue 71)
Thumbnailator 0.4.8 is available via Maven, and JAR files can be downloaded from The Central Repository.
OutOfMemoryError
Workaround
Issues around OutOfMemoryError
s have been recognized from the early stages of development of Thumbnailator. (Issue 1)
However, to fundamentally address the issue requires some dramatic design changes to the core parts of Thumbnailator which would take some time and would affect many internal parts of the library. Such changes would take time before being implemented, a temporary workaround has been added to Thumbnailator 0.4.8 to reduce the likeliness of OutOfMemoryError
s. (Issue 69)
The workaround is not enabled by default, as it can negatively affect the quality of the final image, and has not been extensively tested, and will not necessarily avoid OutOfMemoryError
s.
The workaround can be enabled by one of the following ways:
-Dthumbnailator.conserveMemoryWorkaround=true
, orthumbnailator.conserveMemoryWorkaround
with the value true
.With the workaround enabled, a smaller version of the source image will be used to reduce memory usage, under the following conditions:
This workaround should not be considered a part of the Thumbnailator's public API. This workaround will be removed when its no longer considered useful by the author, therefore, code invoking Thumbnailator should not depend upon this workaround being always present.
Thumbnailator 0.4.7 (December 23, 2013)This release added an user-requested feature (Issue 51) to change the output directory of the thumbnails when using the toFiles(Rename)
or asFiles(Rename)
method.
The following methods have been added:
Thumbnailator 0.4.6 (September 6, 2013)This release addresses the following issues:
Issue 54 - Fixed problems where ant
could not be used to build Thumbnailator.
build.xml
depended on files created by Eclipse, but the dependency has been removedIssue 55 - Fixed a bug that caused the watermark to disappear in certain circumstances when using crop.
Issue 56 - Fixed a bug which caused the watermark to be incorrectly positioned when the EXIF orientation metadata was used to re-orient the image.
LICENSE
file
A change has been made to the location of the LICENSE
file.
Originally, the LICENSE
file was located in the resources
directory, but it has been moved to the root.
In addition, the LICENSE
file has been added to the META-INF
directory of the JAR files being distributes via the downloads and via the Maven Central repository.
This release addresses an issue where the Exif orientation metadata was not being used in the Thumbnailator.createThumbnail
methods. (Issue 43)
This release fixes a bug which causes OutOfMemoryError
s when running Thumbnailator on the latest versions of Java 6 and 7 -- Java 6 Update 45 and Java 7 Update 21. (Issue 42)
Many thanks goes out to Vladimir Shomin, Will Tran and others for providing valuable information in tackling this problem.
Thumbnailator 0.4.3 (January 2, 2013) Added Exif Orientation supportThis release adds support for using the Exif metadata to properly orient thumbnails. (Issue 13, Issue 27)
Now, the default behavior is to use the Exif metadata to determine the correct orientation of the thumbnail.
However, this behavior can be overridden by disabling the usage of theExif metadata by calling the useExifOrientation
method with false
as the argument.
In addition, the message included in the IOException
thrown when an error occurs while processing has been changed to better indicate what had occurred. (Issue 27)
This release fixes an issue where the thumbnails are given incorrect file names when using the Rename.SUFFIX_DOT_THUMBNAIL
or Rename.SUFFIX_HYPHEN_THUMBNAIL
rename option, if the original file name contains multiple "." characters. (See Issue 36 for details.)
This release changes the behavior of deciding the size of the thumbnail.
Up to Thumbnailator 0.4.0, the code used to determine the size of the thumbnail was rounding down (in other words, truncating) the dimensions. For example, if the new dimension was calculated to be 15.4
or 15.6
, the resulting dimension would both be 15
.
Also, there were instances where the dimension(s) of the thumbnail could become 0, leading to an IllegalArgumentException
being thrown when attempting to make a thumbnail.
From Thumbnailator 0.4.1, the code has been revised to round to the closest integer by using the Math.round
method. This means that if the new dimension was calculated to be 15.4
the resulting dimension would both be 15
, while a new dimension of 15.6
would result in the dimension being 16
.
Also, the minimum size of a thumbnail's dimension has been specified to be one. Therefore, under conditions which could lead to the thumbnail having a dimension of zero, the dimension will be promoted to 1
, therefore, the aspect ratio of a thumbnail may not be necesarily maintained.
The following summarizes the changes in thumbnail size between previous versions of Thumbnailator and the current version when using the builder interface*
:
From a original image with dimensions 100 x 106:
version size after.size(10, 10)
size after .scale(0.1)
before 0.4.1 10 x 10 10 x 10 0.4.1 10 x 11 10 x 11
From a original image with dimensions 100 x 104:
version size after.size(10, 10)
size after .scale(0.1)
before 0.4.1 10 x 10 10 x 10 0.4.1 10 x 10 10 x 10
From a original image with dimensions 100 x 6:
version size after.size(10, 10)
size after .scale(0.1)
before 0.4.1 IllegalArgumentException
IllegalArgumentException
0.4.1 10 x 1 10 x 1
*
The builder interface refers to the use of the Thumbnails
class as the entry point when making thumbnails, such as in the code below:
Thumbnails.of("path/to/image")
.size(10, 10)
.toFile("path/to/thumbnail");
The specification of the following classes have been changed in order to implement the changes of calculating the size of the thumbnails:
FixedSizeThumbnailMaker
classScaledThumbnailMaker
classThis release introduces new functionality and minor changes to the API. Please note that upgrading to the Thumbnailator 0.4.0 may require changing to existing code.
Introduction of the ResizerFactory
interface which allows finer control over the resizing of images.
ResizerFactory
's.The ResizerFactory
class in the 0.3.x series has been essentially renamed to the DefaultResizerFactory
class.
The following deprecated methods have been removed:
fromFilenames(Collection<String>)
fromFiles(Collection<File>)
fromURLs(Collection<URL>)
fromInputStreams(Collection<InputStream>)
fromImages(Collection<BufferedImage>)
Although the from...(Collection)
method have been removed, the from...(Iterable)
methods should be functionally equivalent for most scenarios. For example, using a List
as the argument of the from...
methods will work the same as before.
The below code will work under Thumbnailator 0.3.x and 0.4.x without any modifications:
List<String> filenames = new ArrayList<String>();
filenames.add("path/to/image1.jpg");
filenames.add("path/to/image2.jpg");
Thumbnails.of(filenames)
.size(200, 200)
.toFiles(Rename.PREFIX_DOT_THUMBNAIL);
The Rename
class now accepts an additional ThumbnailParameter
as its argument, which enables finer control over determining a name for the resulting thumbnail image file by providing more context about the image resizing operation.
Added the crop(Position)
method to crop the thumbnail after it has been resized while keeping the aspect ratio. This method has been added to address Issue 24.
For example, resizing the image from 240x200 to 100x100 using the crop
method would result in the following:
Canvas
class.
Canvas.apply
method is called multiple times.Added the scale(double, double)
method to create thumbnails by specifying the scaling factors for the width and height independently. This feature implements the feature request in Issue 19.
Added the allowOverwrite(boolean)
to specify the behavior of whether or not to overwrite existing files when creating thumbnails.
The allowOverwrite(boolean)
method will affect the behavior of the following methods:
toFile(File)
toFile(String)
toFiles(Iterable<File>)
toFiles(Rename)
asFiles(Iterable<File>)
asFiles(Rename)
Some changes have been made to the behavior of the methods listed above with respect to handling files which have not been written due to the destination file existing at the time the thumbnails were being produced.
Thumbnailator 0.3.6 (July 9, 2011)A feature has been added to create a thumbnail by only specifying either the width or height, as requested in Issue 12.
The feature will use the specified width or height (via the width
and height
methods) as the constraint, and create a thumbnail which preserved the aspect ratio of the original image.
For example, resizing a 400x300 image with the width constraint specified to 200, the thumbnail will be 200x150.
The code to perform the resize will be as follows:
Thumbnails.of("/path/to/image-400x300")
.width(200)
.toFile("/path/to/thumbnail-200x150")
The following methods were added to the Thumbnails
fluent interface:
It is now possible to specify the source region from which a thumbnail is produced, as requested in Issue 6.
For example, creating a 200x200 thumbnail from the center 400x400 region of the source image could be written like the following:
Thumbnails.of("/path/to/image")
.sourceRegion(Positions.CENTER, 400, 400)
.size(200, 200)
.toFile("/path/to/thumbnail")
The following methods were added to the Thumbnails
fluent interface:
sourceRegion(Region)
sourceRegion(Position, Size)
sourceRegion(int, int, int, int)
sourceRegion(Position, int, int)
sourceRegion(Rectangle)
In order to implement the source region selection feature, new interfaces and classes were added to the net.coobird.thumbnailator.geometry
package, and some retrofitting were done to classes such as ThumbnailParameter
and the ImageSource
subclasses.
The additions to Thumbnailator are backward compatible, and should not affect code written against the Thumbnailator 0.3.x API.
Thumbnailator 0.3.3 (April 30, 2011)IllegalStateException
when creating a GIF thumbnail with the compression quality settings specified. (See Issue 9 for details.)forceSize
method to the Thumbnails
builder interface to force the size of the thumbnail to the specified dimensions. (equivalent to using the size
method along with the keepAspectRatio(false)
method.)Canvas
image filter class which can be used to crop or add a border to the resulting thumbnail.Iterable
to specify the original images through one of the from
methods:
fromFilenames(Iterable<String>)
fromFiles(Iterable<File>)
fromURLs(Iterable<URL>)
fromInputStreams(Iterable<? extends InputStream>)
fromImages(Iterable<BufferedImage>)
from
methods which accept Collection
s have been deprecated.This release introduces significant new functionality and changes to the API. Please note that upgrading to the Thumbnailator 0.3.0 may require changing to existing code. (In most use cases, changes will be limited to updating import
statements and adding exception handling. See below for details.)
Iterable
OutOfMemoryError
s, as Thumbnailator only needs to hold a reference to one thumbnail at a time.URL
s and InputStream
s.OutputStream
s.net.coobird.thumbnailator.name
package contains classes to generate file names for thumbnails being saved to files.The following are backward incompatibles changes:
Coordinate
, Position
and Positions
classes to the net.coobird.thumbnailator.geometry
package.Rename
class to the net.coobird.thumbnailator.name
package.BufferedImages
and ThumbnailatorUtils
classes to the net.coobird.thumbnailator.util
package.asBufferedImages
and asBufferedImage
) now throw IOException
Transparency
image filter for changing the opacity of the resulting thumbnail.asBufferedImage
method causes a NullPointerException
if the original images did not originate from a BufferedImage
.Thumbnails
builder interface.
outputQuality
method which accepts a double
.scalingMode(ScalingMode)
, resizer(Resizer)
, alphaInterpolation(AlphaInterpolation)
, dithering(Dithering)
, antialiasing(Antialiasing)
, and rendering(Rendering)
. * Added checks to see that a supported format is specified in the outputFormat
method.outputFormatType
method, to ensure that the type and format parameters will not be in a state which could cause problems when saving thumbnails.Thumbnails
builder interface to accept Collection
s.ThumbnailParamterBuilder
class to better support the current specification of the ThumbnailParameter
class.ThumbnailTask.write
from returning boolean
to void
, and added the UnsupportedFormatException
class used to indicate that a format is not supported for the specified operation.
StreamThumbnailTask
and FileThumbnailTask
classes have had their write
methods modified to throw the UnsupportedFormatException
and not return a boolean
on return.Thumbnailator.createThumbnail(InputStream, OutputStream, String, int, int)
which can be used to specify the format to use for the output data.asBufferedImage
method to throw an IllegalArgumentException
when multiple images are specified in the Builder.of
method. This makes the behavior more consistent with the toFile
method.Thumbnails.Builder.asBufferedImage
must have BufferedImage
s as the source.ThumbnailMaker
classes will now throw an IllegalStateException
when the size, aspect ratio or scaling factor is specified more than once.
FixedSizeThumbnailMaker
and ScaledThumbnailMaker
classes have been modified due to this change.Thumbnails.of
methods.Thumbnails
class to create thumbnails with the same image type as the original image.
FileThumbnailTask.read()
method to throw a FileNotFoundException
when the File
specified to obtain the original image does not exist.ProgressiveBilinearResizer
class.
Thumbnails
class is now the entry-point into the fluent interface of Thumbnailator.
Thumbnails
class to the Thumbnailator
class.createThumbnails
remain in the Thumbnails
class, however, they have been deprecated and will be removed in the next major revision of Thumbnailator.Thumbnails.Rename
has been promoted to a top-level class.
Thumbnails
class, however, it has been deprecated and will be removed in the next major revision of Thumbnailator.Thumbnails.resizer
to specify the Resizer
to use when creating thumbnails.Thumbnails
class.Thumbnails.createThumbnailCollection
method.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4