GithubHelp home page GithubHelp logo

coobird / thumbnailator Goto Github PK

View Code? Open in Web Editor NEW
5.0K 5.0K 778.0 11.41 MB

Thumbnailator - a thumbnail generation library for Java

License: MIT License

Java 100.00%
fluent-interface image-processing image-resizer java thumbnails

thumbnailator's People

Contributors

coobird avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thumbnailator's Issues

OutOfMemoryErrors (memory leak) when using latest versions of Java 6 and 7

What steps will reproduce the problem?
1. Unzip the attached maven project
2. cd thumbnailator-test
3. mvn test 

Maven runs the test with -Xms256m -Xmx256m. It resizes a png file 100 times, 
then resizes a jpg around 40 times before throwing an OOME. You can also build 
and run an executable jar with 
mvn -DskipTests=true package
java -Xms256m -Xmx256m -jar target/jpegleaker.jar

This fails on Ubuntu, java-version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

This works on Ubuntu java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)



Original issue reported on code.google.com by [email protected] on 16 May 2013 at 12:58

Attachments:

Resizing 8-bit PNG produces poor quality result.

What steps will reproduce the problem?
1. original.png is a 128x128 8-bit paletted PNG.
2.
Builder<? extends InputStream> thumbnailBuilder = Thumbnails.of(new 
FileInputStream("original.png");
thumbnailBuilder.size(80, 80);
thumbnailBuilder.toOutputStream(new FileOutputStream("resized in 
thumbnailator.png"));


What is the expected output? What do you see instead?

I expect a decent resize result, like 'resized in editor.png' (I used Corel 
Photo Paint 12, which retained the 8-bit color depth in the result). Instead I 
see an image with poor color interpolation. Setting the alpaInterpolation, 
antialiasing, dithering, rendering, resizer and scalingMode to the quality 
modes or any of the interpolation algorithms didn't produce a result like the 
one using my editor. 


What version of the product are you using?
0.3.10

On what operating system?
Ubuntu 10

Which version of Java?
JDK 6

Original issue reported on code.google.com by [email protected] on 16 Nov 2011 at 3:41

Attachments:

This introduction snippet doesn't work. Am i missing somethig here?

Thumbnails.of(new File("path/to/directory").listFiles())
        .size(640, 480)
        .outputFormat("jpg")
        .toFiles(Rename.PREFIX_DOT_THUMBNAIL);

What is the expected output? What do you see instead?
It should generate thumbnails but is giving "java.lang.OutOfMemoryError: Java 
heap space"

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
thumbnailator : 0.4.3

Original issue reported on code.google.com by [email protected] on 20 May 2013 at 3:57

  • Merged into: #42

Produced Files Being "Locked"

I'm using something like the following piece of code:

<code>File source = new File("C;\test.png");
File dest = new File("C:\test_thumb.png");
BufferedImage buffered = ImageIO.read(source);
Thumbnails.of(source).forceSize(150, 150).toFile(dest);</code>

This is being run as part of an app running on Tomcat.  The thumbnail is 
created successfully but it appears to be locked in some way.  Although Windows 
will show me a thumbnail of the image, when I try to open the file in a variety 
of programs then the image is unreadable.  If I stop Tomcat, then the file 
becomes readable.

It appears that something is keeping some form of lock open on the file.  If I 
get a chance, I'll dive into the code and see if I can spot what.

This is on Windows, Java 1.6 & using Thumbnailator 0.3.7 (latest at the time of 
writing).

Original issue reported on code.google.com by [email protected] on 27 Jul 2011 at 3:28

Bug with TIFF images : Bits per sample must be 1 for RLE compression

What steps will reproduce the problem?
1. Use Thumbnailator with a TIFF image.

What is the expected output? What do you see instead?

javax.imageio.IIOException: I/O error writing TIFF file!
    at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.write(TIFFImageWriter.java:2669)
    at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.write(TIFFImageWriter.java:2380)
    at net.coobird.thumbnailator.tasks.io.OutputStreamImageSink.write(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.write(Unknown Source)
...
Caused by: javax.imageio.IIOException: Bits per sample must be 1 for RLE 
compression!
    at com.sun.media.imageioimpl.plugins.tiff.TIFFRLECompressor.encode(TIFFRLECompressor.java:116)
...

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?

v0.4.5 on Java 1.7.0_10 with 
jai-imageio-core-standalone-1.2-pre-dr-b04-2013-04-23.

Original issue reported on code.google.com by [email protected] on 29 Jul 2013 at 1:44

  • Merged into: #32

GIF Format Not Supported

What steps will reproduce the problem?
1.Thumbnails.of(OrgFile).size(160, 
128).outputFormat("gif").toFile(E:\\abc\temp);
2.
3.

What is the expected output? What do you see instead?
Specified format is not supported: gif

What version of the product are you using? On what operating system? Which
version of Java?
windows XP, JAVA 1.5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Aug 2011 at 9:44

Which formats does Thumbnailator support?

What steps will reproduce the problem?
1.Gave a tif image as input for thumbnail generation
2.
3.

What is the expected output? What do you see instead?
UnsupportedFormatException

What version of the product are you using? 0.4.1 

On what operating system? Ubuntu 

Which version of Java? 6

Would like to know which formats are supported for thumbnail generation.


Original issue reported on code.google.com by [email protected] on 3 Apr 2012 at 10:51

Independently specify the scaling factors for width and height

Per request from a user, add a new `scale` method overload to specify the 
scaling factor of the width and height independently, i.e.

  Thumbnails.of("path/to/image")
    .scale(0.6, 0.4)
    .toFile("path/to/thumbnail");

In the above code, the width will be scaled by 0.6 times, and height will be 
scaled by 0.4 times.

For example, a source image with dimensions 100 x 100 will result in a 
thumbnail that is 60 x 40. (The resulting image will not maintain the aspect 
ratio of the original.)


Background
---------------

Currently, rescaling an image by a scaling factor will maintain the aspect 
ratio of the width and height.

  Thumbnails.of("path/to/image")
    .scale(0.5)
    .toFile("path/to/thumbnail");

In the above code, if the source image is 100 x 100, the resulting image will 
be 50 x 50.

If one wants to rescale the width to 0.5 and height to 0.6, there is no simple 
one-liner that can be performed with Thumbnailator -- one would have to 
calculate the thumbnail size for each source image, and use one of the `size` 
methods to specify the final image size.


API Design Consideration
-------------------------

This new `scale` method will not maintain the aspect ratio of the original 
image unless the scaling factor for the width and height are equal. Therefore, 
unless the two factors are equal, calling the `keepAspectRatio` method should 
result in an `IllegalStateException`.

Original issue reported on code.google.com by [email protected] on 13 Aug 2011 at 3:22

Caption Image Distortion

I used caption for adding some text to the image which resulted in distortion 
in image as well as added text seems to have some additional pixels around it. 
It can be seen in the attachment here.

Original issue reported on code.google.com by [email protected] on 13 May 2011 at 8:34

Attachments:

Writing resized image issue on tomcat

What steps will reproduce the problem?
1. Start Tomcat and Read source file at %tomcat%/bin/test_image.jpg
2. Read source image and Create resized image by 
Thumbnails.of("test_image.jpg").size(width, height).toFile("test_target.jpg");
3. Console print out following error message and target image created 0 byte.

What is the expected output? What do you see instead?
2012-05-22 10:21:36,328 ERROR [http-8080-3] taglibs.ImageTag  
(ImageTag.java:223)     - java.io.IOException: Could not open output file.
java.io.IOException: Could not open output file.
    at net.coobird.thumbnailator.tasks.io.FileImageSink.write(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.write(Unknown Source)
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)


What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
Thumbnailator 0.4.2
Windows XP
JDK 1.6 (Oracle)


Please provide any additional information below.

I tested this code with junit test module. But result of test was success. See 
following code 

BufferedImage image = Thumbnails.of(srcFile).size(width, 
height).asBufferedImage();
ImageIO.write(image, FilenameUtils.getExtension(targetPath), targetFile);

This code run on tomcat was success.  


I suggest that the message you rewrited in FileImageSink.write() will be change 
by original message. 

Original issue reported on code.google.com by [email protected] on 22 May 2012 at 2:18

Attachments:

Consider integrating the jrawio project to read more image types.

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?


Please provide any additional information below.
The jrawio project provides the ability to read many more image types.

Original issue reported on code.google.com by [email protected] on 10 Apr 2012 at 2:25

Add progress notification via callbacks (a la Event Listeners)

Problem
-------
* Currently, Thumbnailator does not have facilities to provide feedback as to 
the progress of a thumbnail generation task.

This means that if a task takes a long time, there is no way for the 
application using Thumbnailator to give feedback as to the progress of making 
thumbnails.

Also, not providing adequate feedback means that applications using the library 
may not be able to perform adequate logging, which may result in difficulty 
during development and debugging.


Solution
--------
* Provide an event notification facility, similar to the `EventListener`s which 
can be found in the Java APIs.


Complications
-------------
* Many classes would have to be retrofitted to support the event notification 
mechanism.

Original issue reported on code.google.com by [email protected] on 3 Apr 2011 at 11:32

Resize only if larger

Would it be possible to add an option to performs the a resize command only if 
the original file is larger than the dimensions specified. i.e. similar to the 
ImageMagick / GraphicsMagick angle bracket use, e.g.

-size '200x200>'

Original issue reported on code.google.com by [email protected] on 14 May 2011 at 8:57

Problem with resize gif images when output quality is set

I found a problem with resizing gif files when I set output quality. I think it 
is possible to reproduce it with any gif file.

What steps will reproduce the problem?

Sample code:
Working:
BufferedImage bi = ImageIO.read(sourceFile);
        Thumbnails.of(bi).size(90, 63).keepAspectRatio(false).toFile(destFile);

Throwing exception version:
BufferedImage bi = ImageIO.read(sourceFile);
        Thumbnails.of(bi).size(90, 63).keepAspectRatio(false).outputQuality(0.8f).toFile(destFile);


What is the expected output? What do you see instead?
Stacktrace:
Exception in thread "main" java.lang.IllegalStateException: No compression type 
set!
    at javax.imageio.ImageWriteParam.setCompressionQuality(ImageWriteParam.java:1241)
    at net.coobird.thumbnailator.tasks.io.FileImageSink.write(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.write(Unknown Source)
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)
    at ImageResize.resizeImage(ImageResize.java:26)
    at ImageResize.main(ImageResize.java:18)

What version of the product are you using? On what operating system?
0.3.2



Original issue reported on code.google.com by [email protected] on 29 Apr 2011 at 9:10

Add to the Maven Central Repository

Thumbnailator should be available from the Maven Central Repository.

There appears to be projects using Thumbnailator which are using Maven for 
their build management.

Therefore, it would be beneficial to users of Thumbnailator using Maven, if 
adding a dependency didn't require adding the library in a local or internal 
repository.

Information on adding to the Central Repo can be found here:
http://maven.apache.org/repository/index.html

Original issue reported on code.google.com by [email protected] on 3 Apr 2011 at 11:25

Android exception how to?

I try to use the Thumbnailator.jar file and i receive this exception:
Thumbnails.of(...) i receive this error: The type java.awt.image.BufferedImage

What i try to do?

Is to take a picture with my android camera and to put a logo image on bottom 
left corner inside the image and show it. that's it.

Original issue reported on code.google.com by [email protected] on 21 Jul 2011 at 5:04

Poor image quality when scaling factor is > 0.5

Issue
----------
When resizing an image with a scaling factor greater than 0.5, the details of 
the resulting image is not smooth.

Attached are images resized with The GIMP and Thumbnailator.
The image resized with The GIMP has smooth lines, but the image resized by 
Thumbnailator shows lines which are not straight.

Example
----------
  Thumbnails.of("path/to/image")
    .scale(0.66)
    .toFile("path/to/thumbnail");

Original issue reported on code.google.com by [email protected] on 13 Nov 2011 at 6:12

Attachments:

Create multiple thumbnails from a single input image

In one use case, multiple thumbnails of various sizes are made from a single 
original.

Currently, the static interface will presumably (?) need to read the source 
file, which may be many MB, once for each thumbnail it generates.

Allow chaining of multiple .size / .toFile commands in such a way that the 
performance is optimized; as much as possible of the setup and file reading 
logic should be reused.


What is the expected output? What do you see instead?
Same as today, but faster.

What version of the product are you using? On what operating system? Which
version of Java?
I'm using 0.4.0 on Win x64 with JDK 1.7_03, it's working great!

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 6 Mar 2012 at 4:56

Add support for image cliping

Sometimes people want images to be thumbnailed within a range. Maybe it's 
better to offer a way to thumbnail a picture by its x&y coordinates.
If clip is being implemented by you, then I just need sit down and wait. If 
not, maybe I will implement it by myself and post it later.

Original issue reported on code.google.com by [email protected] on 27 Mar 2011 at 1:46

Today, thumbnailator doesn't permit to create a thumbnail keeping aspect ratio AND forcing a defined size

I need to create thumbnails similar to the Facebook ones. What Facebook do is 
maintain the aspect ratio, but forcing a defined size of thumbnail.

It resizes the image to the defined size and then cuts what is left, forcing 
the height or the width (and avoiding blank spaces around the image). For me is 
the best approach when we talk about thumbnails.

I tried to use something like this:

Thumbnails.of(myInputStream).forceSize(width, 
height).keepAspectRatio(true).outputFormat("jpg").outputQuality(1.0f).toOutputSt
ream(myOutputStream);

But it does not work. I think this approach is not possible yet with 
thumbnailator so can you implement it? Just a suggestion to make this library 
even better (it is definately the best and simplest all over the web).

Thanks in advance.

Original issue reported on code.google.com by [email protected] on 13 Oct 2011 at 8:06

Extension is always added to JPG files

Have the following code wrapped in a web service:

Thumbnails.of("C:\\images\\PSC001.JPG")
          .size(160, 160)
          .toFile("C:\\images\\thumbs\\PSC001.JPG");


However, the output (for jpg and jpeg extensions only) is 

C:\images\thumbs\PSC001.JPG.JPEG

if I do .outputFormat("jpg") I get

C:\images\thumbs\PSC001.JPG.jpg

For some reason it always tags on an extra extension.  Don't know if this is 
supposed to happen but could you let me know?

Thumbnailator-0.3.8.jar
jdk1.6.0_20 
NetBeans IDE 7.0 (Build 201104080000)

Thanks
Chris

Great product, thanks

Original issue reported on code.google.com by [email protected] on 8 Aug 2011 at 9:52

Color distortion when rotating image

Problem
----------
An user reported an issue via e-mail that using the `rotate` method causes 
color distortions in the resulting thumbnail.

When not using the `rotate` method, the thumbnail does not exhibit color 
distortion.

Note
----------
The issue seems to occur when a certain type of JPEG image is being rotated. 
Therefore, the problem may lie with the `Rotation` class. (And possibly other 
`ImageFilter` classes as well.)

Original issue reported on code.google.com by [email protected] on 27 Aug 2011 at 2:41

Thumbnail distortion

my english is much poor,sorry -_-

but I really need your help

my runtime environments:
windows 7
JDK 1.6
thumbnailator 0.32


my code:

Thumbnails.of(temp)
.size(maxW, 3000)
.outputQuality(0.8)
.rendering(Rendering.SPEED)
.outputFormat("jpg")
.toFile(new File(f,img.getName().toLowerCase()));

I tried various options, but still did not get the expected results.
so I can only ask for your help.
this is a video shot,attached is the original image and thumbnails.

thumbnailator is a great open source software, thanks.

Original issue reported on code.google.com by [email protected] on 25 Mar 2011 at 3:59

Attachments:

Reorganize the packages

Problem
-------
* There are many classes in the net.coobird.thumbnailator package which would 
be more appropriate if they were placed in their own packages. Currently, there 
are classes with different responsibilities in the same package.


Proposal
--------
* Move the following classes to the following packages:

net.coobird.thumbnailator.util?
 * BufferedImages

net.coobird.thumbnailator.geometry
 * Coordinate
 * Position
 * Positions

net.coobird.thumbnailator.rename?
 * Rename


Complications
-------------
* This will lead to changes to the API which will not be backward compatible.

Original issue reported on code.google.com by [email protected] on 30 Oct 2010 at 3:46

Handle large image files in an memory-efficient manner

Problem
-------
* Currently, Thumbnailator does not have good support for large image files.

For example, there is no protection against running out of memory, and this 
behavior is completely dependent upon the JVM's memory settings.


Solution
--------
* Support tiled reading of image files, rather than reading the entire files at 
once, as is implemented currently.


Complications
-------------
* Changes to support reading images by tiles will most likely lead to changes 
to the API.

Original issue reported on code.google.com by [email protected] on 22 Sep 2010 at 4:28

resize animated gif problem

when i resize a animated gif like this
Thumbnails.of(new File("E:\\images\\test.gif")).size(width, height)
    .useOriginalFormat().toOutputStream(resp.getOutputStream());

the resized image lost color . see the attachement for details.

I'm using jdk1.6



Original issue reported on code.google.com by [email protected] on 19 Mar 2012 at 11:58

  • Merged into: #30

Attachments:

Memory Leak using Thumbnails.of(file).size(getWidth(),getHeight()).asBufferedImage();

What steps will reproduce the problem?
1.  Repeatedly generate thumbnails using code like: 
Thumbnails.of(file).size(getWidth(),getHeight()).asBufferedImage();

What is the expected output? What do you see instead?
If you watch the heap it grows very quickly, by several to tens of megabytes 
each time a thumbnail is generated.

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
Netbeans 7.3 on OS X.

Please provide any additional information below.
Here is a simple program (testimage.jpg is a 2 MB image)
public static void main(String[] args) {
        File theFile = new File("testimage.jpg");
        BufferedImage currentThumbnail = null;

        for (int i = 0; i < 25; i++) {
            System.out.println(i+"\tCurrent Heap Size in MB: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024));
            try {
                currentThumbnail = Thumbnails.of(theFile).size(200, 200).asBufferedImage();
//                currentThumbnail = 
Thumbnailator.createThumbnail(theFile,200,200);
            } catch (Exception e) {
                System.out.println("Could not create thumbnail: " + e.toString());
            }
        }
    }

Below I show the output of the two calls to the library.  Thumbnails.of() 
continues to grow the heap and I run out of 512 MB heap after about 20 
iterations.  Thumbnailator.createThumbnail heap grows to about 125 MB max and 
then sits stable there. I feel like that's a pretty huge heap as well, but at 
least it settles down.

The Internet seems to suggest (various stackoverflow posts I have read) that 
the bufferedimages are probably being kept in a collection somewhere in the 
latter case and the references are never cleared so the images don't get 
garbage collected.  Since the Thumbnails.of approach is the one that handles 
EXIF rotation (my whole reason for using the library), this is dealbreaker for 
me right now. Thought you should know.

 Thumbnails.of output
-----------------------------------
0   Current Heap Size in MB: 1
1   Current Heap Size in MB: 55
2   Current Heap Size in MB: 76
3   Current Heap Size in MB: 122
4   Current Heap Size in MB: 152
5   Current Heap Size in MB: 142
6   Current Heap Size in MB: 194
7   Current Heap Size in MB: 230
8   Current Heap Size in MB: 240
9   Current Heap Size in MB: 240
10  Current Heap Size in MB: 286
11  Current Heap Size in MB: 286
12  Current Heap Size in MB: 332
13  Current Heap Size in MB: 378
14  Current Heap Size in MB: 355
15  Current Heap Size in MB: 400
16  Current Heap Size in MB: 400
17  Current Heap Size in MB: 423
18  Current Heap Size in MB: 446
19  Current Heap Size in MB: 458
20  Current Heap Size in MB: 481
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:59)
    at java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:397)
    at java.awt.image.Raster.createWritableRaster(Raster.java:938)
    at javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1056)
    at javax.imageio.ImageReader.getDestination(ImageReader.java:2879)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1046)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1014)
    at javax.imageio.ImageReader.read(ImageReader.java:923)
    at net.coobird.thumbnailator.tasks.io.FileImageSource.read(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source)
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.asBufferedImage(Unknown Source)
    at thumbtest.ThumbTest.main(ThumbTest.java:29)

Thumbnailator.createThumbnail  output
-----------------------------------
0   Current Heap Size in MB: 1
1   Current Heap Size in MB: 63
2   Current Heap Size in MB: 61
3   Current Heap Size in MB: 121
4   Current Heap Size in MB: 136
5   Current Heap Size in MB: 120
6   Current Heap Size in MB: 133
7   Current Heap Size in MB: 117
8   Current Heap Size in MB: 124
9   Current Heap Size in MB: 113
10  Current Heap Size in MB: 120
11  Current Heap Size in MB: 110
12  Current Heap Size in MB: 117
13  Current Heap Size in MB: 124
14  Current Heap Size in MB: 113
15  Current Heap Size in MB: 120
16  Current Heap Size in MB: 110
17  Current Heap Size in MB: 116
18  Current Heap Size in MB: 123
19  Current Heap Size in MB: 113
20  Current Heap Size in MB: 120
21  Current Heap Size in MB: 110
22  Current Heap Size in MB: 116
23  Current Heap Size in MB: 123
24  Current Heap Size in MB: 113

Original issue reported on code.google.com by [email protected] on 19 May 2013 at 6:26

  • Merged into: #42

Encountering a problem when using the "Thumbnails.of" method

I have the next code line..


BufferedImage thumbnail = Thumbnails.of(input)
                        .size(200, 200)
                        .rotate(90)
                        .asBufferedImage();

were input is a BufferedImage object but i have an error that say me....

the method of(String[]) that exist into the Thumnails is not aplicable to args 
BufferedImage.

Sorry but i don´t speak english languaje, but i understand more or less 
jejeje. 


Original issue reported on code.google.com by [email protected] on 10 Jun 2013 at 10:10

Make possible to obtain image parameters

It would be very useful to add feature to obtain image parameters (width, 
height, etc).

Currently it's possible to get from buffered image object: 
Thumbnails.of(...).scale(1f).asBufferedImage()

Without .scale(1f) it fails with exception though it's unnecessary operation 
for the case.

Original issue reported on code.google.com by [email protected] on 1 Oct 2012 at 11:27

EXIF rotation information not used when using Thumbnailator.createThumbnail(File,int, int)

What steps will reproduce the problem?
1. Take an image with EXIF rotation and use the convenience method to create a 
thumbnail

What is the expected output? What do you see instead?
Since the latest version EXIF rotation information is supposed to be respected. 
This is true if you use: 
Thumbnails.of(file).size(width,height).asBufferedImage();

I would expect the same behaviour for :
Thumbnailator.createThumbnail(file, (width,height)

However, the former rotates according the EXIF and the latter does not.  
Perhaps I'm mistaken, but this seems unexpected.


What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
This is in NetBeans 7.3 (whatever JDK that uses) on OS X 10.8.3.  Your library 
seems to work on OS X btw otherwise, although I have only used a little itty 
bitty piece of it.


Please provide any additional information below.
This is not a showstopper I just thought I'd let you know.  Thanks for this 
fantastic library.  I had written my own little chunk of code and it was messy 
and hacky.  Now it's clean, and it respects the EXIF data.

Original issue reported on code.google.com by [email protected] on 19 May 2013 at 4:40

Use rotation information in EXIF

Problem
-------
* Currently, Thumbnailator does not recognize information in JPEG EXIFs, which 
can lead to photographs taken in portrait mode to be resized in landscape mode.


Solution
--------
* Read the EXIF metadata present in JPEG files
* If the EXIF metadata indicates that the image is in portrait mode, then 
perform a rotation ahead of the thumbnail generation.


Complications
-------------
* The behavior for handling portrait-oriented JPEGs in Thumbnailator will 
change after the introduction of this feature.

Original issue reported on code.google.com by [email protected] on 19 Jun 2011 at 2:35

Exception thrown when attempting to resize a CMYK JPEG

What steps will reproduce the problem?
1.Thumbnails.of(new 
File("/Users/wq/Downloads/covecfe6c5888b1e.JPG")).size(100,100).toFile(new 
File("/Users/wq/Downloads/abc.jpg"));
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
MacOSX,oracle-jdk7.


Please provide any additional information below.
javax.imageio.IIOException: Improper call to JPEG library in state 202
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:550)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:295)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:427)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:543)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:986)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:966)
    at javax.imageio.ImageReader.read(ImageReader.java:940)
    at net.coobird.thumbnailator.tasks.io.FileImageSource.read(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source)
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)

Original issue reported on code.google.com by [email protected] on 26 Jun 2013 at 8:19

Resizing strategy

I cannot use this lib which looks very good because of a missing functionnality 
: Resizing strategy.

I mean, that there is different way to generate a thumbnail, if I ask a 
thumbnail of 100x100
I'd like to choose if 
1. I will keep the ratio by fitting to the biggest dimension (but i will not 
have 100x100 result)
2. I will crop the image 
3. I will add empty area around to have exactly 100x100
4. I will not keep the ratio

As I have seen I can do 1. and 4. but I didn't see how to do 2. and/or 3.
If it exists, forgive me and please consider this as a documentation issue.

I'm sure I will use your lib later but without this functionnality I cannot in 
my current project and I'm going to code again some ugly code for resizing 
images

Original issue reported on code.google.com by [email protected] on 29 Aug 2011 at 3:24

Support flexible inputs and outputs

Problem
---------------
Thumbnailator does not currently have a simple way to support differing inputs 
and outputs, i.e. thumbnails created from image files can only be output to 
files.


Solution
---------------
The `ThumbnailTask` class is designed to accept an input and output and perform 
processing to create thumbnails.

By creating a new `ThumbnailTask` along with input and output interfaces which 
can plug into that new `ThumbnailTask`, it would be possible to support 
differing input and output formats.

This approach has an additional benefit that the existing code for processing 
thumbnails (such as the `Thumbnailator.createThumbnail(ThumbnailTask)` method) 
can be used as is.


Complications
---------------
No major complications can be found.

Original issue reported on code.google.com by [email protected] on 23 Dec 2010 at 4:36

Can't properly process abnormal .jpg format picture

What steps will reproduce the problem?
1.Use thumbnailator process the following file,scale the size ,and save it. 
you'll find that the color lost or the color is not correct.

I find a reason is that the jpg file header is unnormal. and not start with 
JFIF chars.(you can see when you open it with HEX editor).
so I wish thumbnailator can process the unnormal jpg file correctly.tks.

Env:

jdk 1.6,cent os or win7, thumbnailator 0.4.5 ,Tomcat 6

Original issue reported on code.google.com by [email protected] on 10 Jul 2013 at 9:41

Attachments:

java.lang.OutOfMemoryError: Java heap space

What steps will reproduce the problem?
1. Run the test file. I got an ok from the first test method and 
OutOfMemoryError from the second method.
2.
3.

What is the expected output? What do you see instead?
Both ok.

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
Window jdk 1.6.45

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 22 May 2013 at 8:01

  • Merged into: #42

Attachments:

add support of image flipping

To support all methods of EXIF rotation, there should be a support of image 
flipping. Please add methods Builder.flipX() and Builder.flipY(). This is also 
a prerequisite of Issue 13.

Thanks in advance.

Original issue reported on code.google.com by [email protected] on 16 Nov 2011 at 8:19

The thumbnail file size is as big as the original image

The size of original image is 11MB, and its resolution is 3312*4416,i use the 
following code to compress original image:
Thumbnails.of(originalImage).size(600, 800).toFile(originalImage);
The size of  compressed image is also 11MB, and its resolution is 600*800. But 
if i change parameters:
Thumbnails.of(originalImage).size(90, 120).toFile(originalImage);
The size of compressed image is 2KB.
How to solve this problem? Sorry for my poor English.

Original issue reported on code.google.com by [email protected] on 28 Jun 2011 at 6:23

Maven repository for thumbnailator

Hi,

It would be nice if you would made your releases accessible as a maven 
repository.

Some interesting links about how to do it:
1) 
http://www.thewebsemantic.com/2009/04/11/your-very-own-google-code-maven-repo/
2) 
http://stackoverflow.com/questions/1280470/maven-repository-for-google-code-proj
ect

Original issue reported on code.google.com by [email protected] on 19 Jul 2011 at 11:22

  • Merged into: #7

Content assist in Eclipse does not show the correct argument names

Problem
-------
* When using the content assist (pressing Ctrl-Space in Windows) with the 
`Thumbnails` builder interface, the method argument names appear as `arg0`, ... 
, `argn` rather than the actual argument name.

* The issue is with a bug in Eclipse which cannot provide content assist for 
inner classes correctly.
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=151500
 * The issue is to be fixed in Eclipse 3.7, according to the above ticket.


Solution
--------
* Move the `Thumbnails.Builder` inner class to a top-level class.
 * Although the bug is to be fixed in the next release of Eclipse, one cannot reasonably expect that all users will transition to the new version.
 * Solving this problem is in the interest of Thumbnailator users, as it decreases the user-friendliness of the library.


Complications
-------------
* It has the potential to break non-standard usage of the API, such as code 
which is assigning the `Thumbnalis.Builder` object to a variable:

  // The following code will break:
  Thumbnails.Builder builder = Thumbnails.of(...);


Original issue reported on code.google.com by [email protected] on 21 Mar 2011 at 10:08

Exception reading a CMYK Jpeg

What steps will reproduce the problem?
1. Generate a CMYK JPG, call it selectedFile
1. Run Thumbnails.of(selectedFile).size(500, 500).toFile(thumb500File);

What is the expected output? What do you see instead?

Expected output - thumb500File created normally

Actual output: Exception raised "Incompatible color conversion"

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?

OpenJDK 7u9, Ubuntu Linux

Please provide any additional information below.

The core Java method ImageIO.read produces exactly the same exception, e.g.

BufferedImage originalImage = ImageIO.read(selectedFile);

so it looks like the issue is with Java, however other people have found 
workarounds - 
http://www.randelshofer.ch/blog/2011/08/reading-cmyk-jpeg-images-with-java-image
io/

Would it be possible to implement a workaround in Thumbnailator too? I think 
the Java issue dates back some time.

A sample JPG exhibiting the problem is attached.

Original issue reported on code.google.com by [email protected] on 1 Nov 2012 at 12:59

Attachments:

Wrong rename (asFiles) for output

What steps will reproduce the problem?
1. Using ".asFiles(Rename.SUFFIX_DOT_THUMBNAIL)"
2. On files which has a "." in the file name.
3. Example: "orig.image.jpg"
4. Will produce: "orig.thumbnail.image.jpg"
5. Instead of the desired output: "orig.image.thumbnail.jpg"

What is the expected output? What do you see instead?
See above.

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
Java 7 (1.7.0_04)
Thumbnailator 0.41
Amazon Linux AMI 2012.03

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 4 May 2012 at 10:17

When scaling transparent png images, the colors are being negated.

What steps will reproduce the problem?
1. Scale the attached image and convert to jpeg.
2.
3.

What is the expected output? What do you see instead?
The scaled image is expected in jpeg format.
Getting a scaled jpeg image with negative image color.


What version of the product are you using? On what operating system? Which
version of Java?
Thumbnailator 3.9
Java 1.6.21
Windows 7



Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 22 Sep 2011 at 12:18

Attachments:

Replace the use of File with Path

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ? Java 7


Please provide any additional information below.
Java 7 introduced Path. Perhaps you can use Path instead of File.

Original issue reported on code.google.com by [email protected] on 10 Apr 2012 at 2:22

Scale(double, double) does nothing

What steps will reproduce the problem?
1. Add jar to project (eclipse)
2. Run code:

Thumbnails.of(file.getInputStream())
                    .scale(100, 100)
                    .outputFormat(newFile.getExtension())
                    .toFile(newFile.getAbsolutePath());

I want to recieve the scaled thumbnail image, but this piece of code does 
nothing without throwing any exception. What is interesting that if I change it 
to size (with same parameters):
Thumbnails.of(file.getInputStream())
                    .size(100, 100)
                    .outputFormat(newFile.getExtension())
                    .toFile(newFile.getAbsolutePath());


I am using 0.4.2 version on Win7x64, JDK version 6.

Original issue reported on code.google.com by [email protected] on 10 Aug 2012 at 5:21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.