iFrankWu / thumbnailator

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

Watermark disappears using the "crop" function #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Thumbnails.of(originalImage)
.size(660, 
400)                        .crop(Positions.CENTER)                         .watermark(Positions.BOTTOM_RIGHT, 
ImageIO.read(new File(...)), 
0.9f)                       .outputQuality(0.7f)                            .outputFormat("jpg")
.toFile(new File(...));

The watermark disappears when I use the crop function

Version 0.4.5, Java 7 (Oracle)

Original issue reported on code.google.com by diogo.arm on 5 Sep 2013 at 2:03

GoogleCodeExporter commented 9 years ago
Thank you for taking the time to report this issue.

I was able to reproduce this bug by calling `crop` then calling `watermark`:

  Thumbnails.of("path/to/image")
    .size(300, 300)
    .crop(Positions.CENTER)
    .watermark(Positions.BOTTOM_RIGHT, ImageIO.read(new File("path/to/watermark")), 0.5f)
    .toFile("path/to/thumbnail");

The need to fix this bug has been acknowledged.

Original comment by coobird...@gmail.com on 5 Sep 2013 at 10:01

GoogleCodeExporter commented 9 years ago
Additional notes to self:

When running the following code, the watermark is shown properly:

  Thumbnails.of("path/to/image")
    .size(300, 300)
    .crop(Positions.CENTER)
    .watermark(Positions.CENTER, ImageIO.read(new File("path/to/watermark")), 0.5f)
    .toFile("path/to/thumbnail");

Therefore, this appears to be an issue where the size *before* the crop is 
being used to calculate the position of the watermark, causing the watermark to 
be drawn outside of the thumbnail.

Original comment by coobird...@gmail.com on 5 Sep 2013 at 10:03

GoogleCodeExporter commented 9 years ago
A fix has been created.

This will be rolled into the next release.

Original comment by coobird...@gmail.com on 5 Sep 2013 at 12:54

GoogleCodeExporter commented 9 years ago
thank you!

Original comment by diogo.arm on 5 Sep 2013 at 2:35

GoogleCodeExporter commented 9 years ago

Original comment by coobird...@gmail.com on 6 Sep 2013 at 6:16

GoogleCodeExporter commented 9 years ago
This issue has been addressed in Thumbnailator 0.4.6.

Original comment by coobird...@gmail.com on 8 Sep 2013 at 5:19