Comments (7)
Hello!
Thank you for your suggestion.
I've received a request for a similar feature via e-mail from another user of
Thumbnailator, so I think there is a real need for this feature.
Currently, Thumbnailator allows *post*-processing of thumbnails, but no
*pre*-processing (such as cropping) of the original image before the image is
resized.
Therefore, I'll definitely look into implementing this feature, probably in
early April.
Any feedback on specific use cases are greatly welcome.
Chris
---
P.S. Thumbnailator 0.3.2 has introduced the `Canvas` image filter
(http://thumbnailator.googlecode.com/hg/javadoc/net/coobird/thumbnailator/filter
s/Canvas.html) which will allow the thumbnail to be cropped.
However, as mentioned earlier, this affects the *thumbnail* -- the cropping
takes effect on the thumbnail, not the original image.
P.P.S I'm going to reclassify this as a "Type-Enhancement" to reflect the type
of issue this is.
Original comment by [email protected]
on 29 Mar 2011 at 4:01
- Changed state: Accepted
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from thumbnailator.
Very much looking forward!
this feature is useful for me.
Original comment by [email protected]
on 31 Mar 2011 at 4:29
from thumbnailator.
I want download an original image and add my logo
The feature is what i'm looking for. :D
Original comment by [email protected]
on 8 Apr 2011 at 3:33
from thumbnailator.
Work has commenced on a feature to be able to specify the region of the source
image to use when creating a thumbnail.
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")
* Final APIs are subject to change.
The work is underway in the `source-region` branch:
http://code.google.com/p/thumbnailator/source/browse/?r=source-region
Original comment by [email protected]
on 23 Apr 2011 at 6:20
- Changed state: Started
from thumbnailator.
A new feature enhancement has been released as part of Thumbnailator 0.3.4.
Now it is possible to specify the source region to use when creating a
thumbnail through the `Thumbnails` fluent interface.
The example shown in Comment 4 is now possible, along with a few more options
for specifying the size and position.
For more information, please refer to the "Changes" for 0.3.4:
http://code.google.com/p/thumbnailator/wiki/Changes#Thumbnailator_0.3.4_%28May_3
,_2011%29
Original comment by [email protected]
on 3 May 2011 at 12:17
- Changed state: Fixed
from thumbnailator.
Since you don't mention that it is an error, I presume that the source region
can be bigger than the image. When this is the case how do you specify the
colour used the pad the source image?
Original comment by [email protected]
on 15 Jun 2011 at 10:46
from thumbnailator.
Hello [email protected],
Indeed, it is not an error to specify a source region that is larger than the
original image.
I realize that the `sourceRegion(...)` method is poorly documented, but the
behavior for this scenario is that the region outside of the original image
will simply be ignored -- in essence the final source image region is an
intersection of the original image size and the specified source region.
For example, if the original was 200x200, and the source region was 400x400 at
(0,0), the resulting image will be 200x200.
This behavior was specified this in the back-end processing class
(`Region.calculate` -
http://thumbnailator.googlecode.com/hg/javadoc/net/coobird/thumbnailator/geometr
y/Region.html#calculate(int,%20int)), but neglected to include the details in
the `sourceRegion` method; I'll be sure to document this in the next release.
The answer to the final question is, there isn't a way to specify the padding
color, as the current behavior does not perform padding.
If a feature to pad the source region outside of the original image is a
feature that is needed, please file a new issue for a feature enhancement. (Or
let me know and I'll add one when I get a little more free time.)
Thanks!
Original comment by [email protected]
on 15 Jun 2011 at 2:11
from thumbnailator.
Related Issues (20)
- How to ensure the GIF dynamic effect after compression HOT 1
- Do you have plans to support WebP, AVIF? HOT 1
- Thumbnail not properly generating from PNG images HOT 2
- Image color loss during conversion HOT 3
- Define an Automatic-Module-Name HOT 1
- the image format webp is not support HOT 5
- No suitable ImageReader found for source data errors HOT 1
- After resize the image is rotated HOT 3
- 300dpi tiff image changed to 96pi jpg but pixel does not chage HOT 1
- Incorrect cropping when specifying sourceRegion and an image that has exif orientation HOT 2
- Multi-threaded processing of images with large pixel width and height leads to memory OutOfMemoryError
- the .pict file is not supported HOT 1
- javax.imageio.IIOException: Invalid JPEG file structure: two SOF markers HOT 1
- Add crop method usage to examples HOT 2
- How to make the image width fixed when the image is scaled HOT 1
- Does the thumbnailator support generating thumbnails for png images? HOT 1
- Conversion error caused by image reading failure
- Native image service unable to compress image
- jpg color turn red HOT 2
- webp format image campress fail with exception "No suitable ImageReader found for source data" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thumbnailator.