• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

image clarity for jpeg after converting to pdf using iText

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all:
I am using iText API to convert images to pdf and was trying to preserve the image resolution when displayed in pdf file and the getDpiX() and getDpiY() methods which returns the DPI for the original image are returning zero values where as the values returned to other type of images are alright.
can some help me in this.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

According to the javadocs, those methods "Returns 0 if not available". What kind of image is this - a GIF?

Is the image quality actually less than it was originally?
 
Krishna Chaitanya Reddy Balam
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.png image returns the true Dpi but any .jpg image returns zero for getDpiX and getDpiY methods.
 
Krishna Chaitanya Reddy Balam
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The .jpg images I tried had 96 DPI on both X and Y, but the methods returned zero values and I was not able to even setDpi()for the image displayed in pdf.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have reason to believe that using an image with iText changes its DPI? In other words, is it necessary to do this? That goes back to my previous question of whether the image quality is actually worse.
 
Krishna Chaitanya Reddy Balam
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes iText by default changes the resolution to 72 DPI for any image which is displayed in pdf so it decreases the clarity and this is the main problem.
 
Get me the mayor's office! I need to tell him about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic