Code Monkey home page Code Monkey logo

Comments (11)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
[deleted comment]

from thumbnailator.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
> 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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 29, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.