I have a program where given an image I want to read the coordinates for each pixel. I have implemented the code if the given image is a TIFF image and it works fine. The code that gives me the object with the coordinates is as follow:
File f = new File("image.tiff");
GridCoverage2D image = new GeoTiffReader(f).read(new GeneralParameterValue[]{policy, gridsize, useJaiRead});
Rectangle2D bounds2D = image.getEnvelope2D().getBounds2D();
bounds2D.getCenterX();
GridGeometry2D geometry = image.getGridGeometry();
I want to try now to read the same image but in another format (jpgJPEG and pngPNG). I have downloaded the images and each has a world file (pgw/jpw) and an aux file.
How can I obtain the same output I have on the TiffTIFF file for these formats?
I am new to Java and geotools so I am a little lost. Thank you in advance!