Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to read DPI from an Image  RSS feed

 
Ktrup Pol
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to read the DPI information from an BufferedImage using ImageIO.
I would like to use ImageIO API.

How can i do this.

Thanks,
Trupti
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

ImageIO has no provisions for this, but the ImageInfo class does.
 
Ktrup Pol
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the reply.
I have gone thru the ImageInfo class but i don't think it will solve my problem since it doesn't provide support to tiff and many more other formats.

Actually the thing is i am getteing an input image from a GridCoverage whose type and format i don't know at runtime.
And i am suppose to convert it into .jp2 format. Currently the situation is using ImageIO i am able to convert it into jp2 format.
But the issue is resolution and size of image decreases considerabley.

Forget abt size but i can't afford decrease in resolution factor since image is a GIS information.
I am suppoe to maintain the resolution of the output(jp2) image as that of the input(*.*) image.
or worst case decrease in resultion factor must be as minimum as possible.

I am also attaching a sample code what i am doing right now.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!