I'm trying to render a pdf (with pdf-renderer or jpedal), and it can't handle an image encoded using JPX. Is there any open-source java library that can decode JPX?
JPX needs JPEG2000 which needs the JAI and imageIO libraries. JPedal has support for JPX - you just need to enable it which explained on the support section.
There is a patched version of the imageio to fix the memory bug on our site at http://www.jpedal.org/PDFblog/2011/03/java-jai-image-io-jpeg2000-memory-leak-fix/
Related
Can you encode/decode image into WebP in Pure Java without any native library?
What I've seen are implementations that use external library, either embedded or otherwise to the library.
There is a git repo which encode decodes webp with animation support but It does not support the transparent background yet. I had to set image background as solid color to use those image for encode decode.
To make changes in this project or add alpha channel support (transparency) you should learn about googl's webp container specifications
I have TIFF files that contain a single image.
I need to be able to convert them to PNG inside our Java app.
Almost every search says to use JAI - which doesn't seem to exist anymore.
We currently have the itextpdf library in our system, and it looks like it can read a TIFF and write a PNG.
Anyone know how? Or can point me to the correct section of documentation?
I see that there is a TIFFImage class that looks like it can read a TIFF, and a PNGWriter that can write a PNG - but I haven't been able to figure out how to take the result of the TIFFImage (an Image object) and pass that data to the PNGWriter.
You can use standard ImageIO and my TwelveMonkeys ImageIO TIFF plugin to read the TIFF and write it back as PNG. The plugin can in most cases be used as a direct replacement for the JAI ImageIO TIFF plugin.
When the plugin is installed, your TIFF is single page, and all you care about is the pixel data, the code could simply be:
BufferedImage image = ImageIO.read(tiffFile);
if (!ImageIO.write(image, "PNG", pngFile)) {
// Handle file not written
}
I would not recommend using iText for this (and neither would Bruno Lowagie, it seems). :-)
Im trying to check how to generate TIFF using JAVA libraries. I checked JAI, but it requires native libs that I can't use in my project (it must be platform-independent).
I saw a great library, Apache Commons Imaging that generates successfully TIFF, I tried and ...its good.
But I didnt see any way to create TIFF with several pages.
Is there any way to do this?
Thanks!
You can do it with icafe Java library (disclaimer: I am the author of this library). No dependency on any native stuff. Look at the wiki page for item Create multipage TIFF image for example. You can also control the color type and compression method for different pages. Dithering can be set through parameters in case color quantization is required such as saving images to black and white using CCITT group3/group4 compression. The resulting multipage image from the wiki page can be found here.
This question is hard to answer via Google. I want to know if someone familiar with GeoTools can let me know whether or not it can read in Digital Elevation Models? Their website does not list it, but it seems to be a normal, common raster data format.
Thanks in advance
I think that you may take a look to the gtopo30 plugin:
http://docs.geotools.org/latest/userguide/library/coverage/gtopo30.html
http://docs.geotools.org/latest/userguide/faq.html
Which is also supported by GeoServer:
http://docs.geoserver.org/stable/en/user/data/raster/gtopo30.html
Ref:
https://en.wikipedia.org/wiki/Digital_elevation_model
Cheers,
Carlo Cancellieri
From the GeoTools FAQ:
GeoTools supports additional formats through the use of plug-ins. You can control the formats supported by your application by only including the plug-ins you requrie.
arcgrid
arcsde
db2
raster formats
geotiff
grassraster
gtopo30
image - world plus image files using common image formats such as JPEG, TIFF, GIF and PNG
imageio-ext-gdal (allows access to additional GDAL formats thanks to the ImageIO project)
imagemoasaic
imagepyramid
JP2K
Database “jdbc-ng” support
h2
mysql
oracle
postgis
spatialite
sqlserver
postgis
property - simple text file format often used for testing
shapefile
Note the use of GDAL to import exotic formats - so if you can't read it in then it's really weird.
This question already has answers here:
Can't read and write a TIFF image file using Java ImageIO standard library
(5 answers)
Closed 4 years ago.
Now I have to do some processing(such as read/save) with some .tif images, but it seems like I can not read or write the images by java. Is there any library can help me for that? And How to used it to read or save the images? Thanks for your answer.
I guess you will need to use the JAI (Java advances imaging package), take a look at this, and see this example
Java Advanced Imaging provides support for TIFF out of the box. Alternately add a Service Provider Interface Jar for TIFF on the run-time class-path of the app. and ImageIO will be able to deal with them (load them at least, it probably won't provide support for 'multi-page' TIFF writing).
Java supports reading and writing jpeg, gif and png by default, using ImageIO. In order to read tiff images, you must use a JAI plugin called jai_imageio.jar. You just put this jar in the classpath and you will be able to read tiff images.
used jai not working now, can't get "com.sun.image".
But found another package that works - jdeli. It has a class TiffDecoder, which can be used to decode(read) tiff images with alpha channel to a Buffered image. Then you can write that image using ImageIO.write