Closed GoogleCodeExporter closed 9 years ago
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 coobird...@gmail.com
on 14 May 2011 at 4:24
[deleted comment]
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 sonesh.d...@gmail.com
on 16 May 2011 at 1:46
Attachments:
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 sonesh.d...@gmail.com
on 16 May 2011 at 1:53
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 coobird...@gmail.com
on 16 May 2011 at 1:57
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 sonesh.d...@gmail.com
on 16 May 2011 at 2:48
Attachments:
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 coobird...@gmail.com
on 16 May 2011 at 3:11
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 sonesh.d...@gmail.com
on 16 May 2011 at 5:57
> 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 coobird...@gmail.com
on 17 May 2011 at 1:29
Agreed . Thanks a lot for all your help even though it was not a
thumbnailator related issue.
Original comment by sonesh.d...@gmail.com
on 17 May 2011 at 1:40
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 coobird...@gmail.com
on 17 May 2011 at 1:54
Original issue reported on code.google.com by
sonesh.d...@gmail.com
on 13 May 2011 at 8:34Attachments: