Comments (11)
Thank you for filing an issue.
I'd like to get some clarification on the following:
1. What is the expected result? How does it differ from the expectations?
2. What is the source image? Could you attach the source image, or at least a
thumbnail of the source image?
3. What was the code used to produce the thumbnail?
4. Which OS and JDK was used? (With versions included.)
Without the above information, (especially point 3) I will not be able to
reproduce the issue.
Original comment by [email protected]
on 14 May 2011 at 4:24
from thumbnailator.
[deleted comment]
from thumbnailator.
1. I attached Original and Expected images and you can see processed image
above.
2. Attached
3.
BufferedImage photo = ImageIO.read(new File(inputImagePath));
Font font = new Font("Monospaced", Font.PLAIN, 14);
Color c = Color.black;
Position position = Positions.CENTER; // I have set fixed x and y for now in
drawString.
int insetPixels = 0;
Caption filter = new Caption("Some Test Text Here.", font, c, position,
insetPixels);
BufferedImage captionedImage = filter.apply(originalImage);
4. OS : Ubuntu 8.04.4
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
I would really appreciate your help in this matter.
Original comment by [email protected]
on 16 May 2011 at 1:46
Attachments:
from thumbnailator.
Not sure if adding rendering
hints(http://download.oracle.com/javase/tutorial/2d/text/renderinghints.html)
will make any difference . I already tried but it didn't make any difference.
Original comment by [email protected]
on 16 May 2011 at 1:53
from thumbnailator.
Thank you for the follow up.
By distortion, are you referring to the "extra pixels" which are visible around
the black text on the white background?
If that is the case,
1. Does the "distortion" by chance appear when the image is saved to a JPEG
image?
2. Is the "distortion" present when saving the image as a PNG?
Original comment by [email protected]
on 16 May 2011 at 1:57
from thumbnailator.
Thanks for such a fast respose !
That's what it is ! Extra pixels went away after saving image as png . You can
see the difference in attached jpg and png image . Does that mean I have to
save all images as .png in order to have text over them ?
Original comment by [email protected]
on 16 May 2011 at 2:48
Attachments:
from thumbnailator.
Good to know that we're getting to the bottom of this issue! :)
The issue is with how JPEG image compression works.
JPEG image compression is a category of image compression called "lossy
compression", which is able to achieve very high compression ratios at the cost
of sometimes introducing what are called "compression artifacts".
In the case of JPEGs, the compression artifacts are sometimes very visible when
there is a sharp contrast between colors, as in the case of black text on a
white background.
JPEGs are good for photographs (as they usually do not have very sharp
differences in contrast) but work very poorly for text and line illustrations.
If the text *must* be crisp without any compression artifacts, one must use an
"lossless compression" such as PNG, or use a non-compressed image format, such
as an uncompressed BMP image.
This is not an issue with Thumbnailator, rather it is the nature of using JPEG
image compression.
For more information:
* http://en.wikipedia.org/wiki/Lossy_compression
* http://en.wikipedia.org/wiki/JPEG
* http://en.wikipedia.org/wiki/Compression_artifact
* http://en.wikipedia.org/wiki/Lossless_data_compression
* http://en.wikipedia.org/wiki/Portable_Network_Graphics
Original comment by [email protected]
on 16 May 2011 at 3:11
from thumbnailator.
Yes only solution seems is to use PNG . Although just checking do you think
solution provided by user "x4u"
(http://stackoverflow.com/questions/5995798/java-text-on-image) can work with
JPEG ?
Original comment by [email protected]
on 16 May 2011 at 5:57
from thumbnailator.
> Although just checking do you think solution provided by user "x4u"
> (http://stackoverflow.com/questions/5995798/java-text-on-image) can work with
JPEG ?
It's not really a matter of "can it work with JPEG", but rather it is an
approach that could be taken if using a JPEG is your only option.
JPEG allows you to specify the compression level (and hence the image quality),
and loosening the compression level can reduce the amount of compression
artifacts, but it is not a guarantee that your image will look as good as an
uncompressed image.
I'm going to close this issue as it is now apparent that the root of the issue
does not concern with defects or bugs with Thumbnailator.
Original comment by [email protected]
on 17 May 2011 at 1:29
- Changed state: Done
- Added labels: Type-Other
- Removed labels: Type-Defect
from thumbnailator.
Agreed . Thanks a lot for all your help even though it was not a
thumbnailator related issue.
Original comment by [email protected]
on 17 May 2011 at 1:40
from thumbnailator.
Thank you for taking your time to responding to my questions.
If you have any ideas or requests for the Thumbnailator library, please let me
know!
Good luck! :)
Original comment by [email protected]
on 17 May 2011 at 1:54
from thumbnailator.
Related Issues (20)
- No suitable ImageReader found for source data(jpeg Picture format) HOT 2
- 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
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.