mirszhao / thumbnailator

Automatically exported from code.google.com/p/thumbnailator
Other
0 stars 0 forks source link

Scale(double, double) does nothing #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 vicmo...@gmail.com on 10 Aug 2012 at 5:21

GoogleCodeExporter commented 9 years ago
Forgot to add - interesting that if I change it to size (with same parameters) 
the code works fine

Original comment by vicmo...@gmail.com on 10 Aug 2012 at 5:22

GoogleCodeExporter commented 9 years ago
Sorry for the late response.

The `scale` and `size` methods achieve different things.

* The `scale` method is to be given a scaling factor, such as 0.5, to reduce 
the image to 50% of the original image.

* The `size` method is given the actual size that the thumbnail should be, in 
pixels.

Therefore, depending on what you're trying to achieve, the choice between using 
`size` or `scale` will differ.

Since you've mentioned in Comment 1 that using `size` works fine, I'm going to 
assume that the `size` method is able to achieve what is being sought after.

That said, using `scale(100, 100)` resulting in "nothing" does seem odd, so I'm 
have to try it out and see if I can reproduce the problem.

Thank you for the feedback.

Original comment by coobird...@gmail.com on 25 Aug 2012 at 6:12

GoogleCodeExporter commented 9 years ago
This issue has not been updated in more than half a year, so I will assume that 
the issue has been resolved.

Original comment by coobird...@gmail.com on 7 Apr 2013 at 8:19