jai

Cannot run or jai_imageio or ImageIO.getImageReadersByFormatName cannot get Object

荒凉一梦 提交于 2019-12-07 08:56:56
问题 I'm running a program that using jai_imageio.jar and then validating if I can get ImageIO.getImageReadersByFormatName("tiff") for some reason the program is running on other server, But when I checkout / load it into my server it always cause an error java.util.NoSuchElementException at javax.imageio.spi.FilterIterator.next(Unknown Source) at javax.imageio.ImageIO$ImageReaderIterator.next(Unknown Source) at javax.imageio.ImageIO$ImageReaderIterator.next(Unknown Source) I've already spending

How to add TIFF ImageReader to those registered in Grails

本小妞迷上赌 提交于 2019-12-07 08:18:31
问题 I'm trying to create a Grails application that can display previews of TIFF files, and other images as well. Background The images are constructed from a SOAP service that gives me the bytes of the image. In a service method, I take the byte[], construct a ByteArrayInputStream from it, and then create a BufferedImage from that. def inputStream = new ByteArrayInputStream(bytes) BufferedImage originalImage = ImageIO.read(inputStream) ImageIO.write(originalImage, 'png', response.outputStream)

How to use ColorQuantizerDescriptor?

江枫思渺然 提交于 2019-12-06 13:23:15
Following the idea of @PhiLho's answer to How to convert a BufferedImage to 8 bit? , I want to use ColorQuantizerDescriptor to convert a BufferedImage , imageType TYPE_INT_RGB, but RenderedOp#getColorModel() is throwing the following exception: java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel. at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:541) at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878) at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2253) This is the code that I am attempting to use:

ImageIO support for raw images (jrawio)

好久不见. 提交于 2019-12-06 09:45:46
I was looking for raw image support and found this library (jrawio-1.6.1) which extends imageio to add raw support. It seems to work but awfully slow. I've seen snails that were faster. My code processes Jpegs in seconds and it takes minutes to process a not that much bigger .cr2 file or .nef. I could be wrong but I think it even slowed down the tiff processing. The last tiff file was very big so that could have been the problem too. Another issue I have with this library is that development seems to have ceased in 2009. What are my Alternatives? I tried including JAI but some of the libraries

Scaling images with Java JAI

ε祈祈猫儿з 提交于 2019-12-05 23:58:08
问题 I have to scale an image with Java JAI. At the time now, I use the following code: private static RenderedOp scale(RenderedOp image, float scale) { ParameterBlock scaleParams = new ParameterBlock(); scaleParams.addSource(image); scaleParams.add(scale).add(scale).add(0.0f).add(0.0f); scaleParams.add(Interpolation.getInstance(Interpolation.INTERP_BICUBIC_2)); // Quality related hints when scaling the image RenderingHints scalingHints = new RenderingHints(RenderingHints.KEY_RENDERING,

How to add GPS metadata to TIFF in Java?

故事扮演 提交于 2019-12-05 20:34:28
I am attempting to add GPS data to a TIFF file I am creating in Java. I am using the JAI-ImageIO libraries, although if there is a better library for doing both GPS metadata and custom metadata, I am willing to look into it. I have attempted to add the GPS metadata to the nodes directly, but it seems to strip off the GPS IDF tag. I have attempted to add the GPS IFD to the TIFFIFD object (from the TIFFIMageMetadata object), but that doesn't seem to save the data properly. Basically, I am struggling to get it to save the GPS data properly, and trying to figure out how to get the data in there.

Cannot run or jai_imageio or ImageIO.getImageReadersByFormatName cannot get Object

家住魔仙堡 提交于 2019-12-05 15:40:32
I'm running a program that using jai_imageio.jar and then validating if I can get ImageIO.getImageReadersByFormatName("tiff") for some reason the program is running on other server, But when I checkout / load it into my server it always cause an error java.util.NoSuchElementException at javax.imageio.spi.FilterIterator.next(Unknown Source) at javax.imageio.ImageIO$ImageReaderIterator.next(Unknown Source) at javax.imageio.ImageIO$ImageReaderIterator.next(Unknown Source) I've already spending half of my day with this.. but still can't figure it out. I hope someone can tell what's wrong with my

Convert RGB PNG to CMYK JPEG (using ICC Color Profiles)

北慕城南 提交于 2019-12-05 14:16:39
I need to convert a PNG-File into a CMYK JPEG. During my research i've found multiple articles on SO decribing that problem. I've copied this answer using BufferedImage and ColorConvertOp . I came up with this little example: public static void main(final String[] args) throws IOException { final String imageFile = "/tmp/page0.png"; final BufferedImage pngImage = ImageIO.read(new File(imageFile)); // convert PNG to JPEG // http://www.mkyong.com/java/convert-png-to-jpeg-image-file-in-java/ final BufferedImage rgbImage = new BufferedImage(pngImage.getWidth(), pngImage.getHeight(), BufferedImage

Convert a bitmap image to an uncompressed tif image in Java

被刻印的时光 ゝ 提交于 2019-12-05 13:05:50
I'm trying to convert a bitmap image into an uncompressed tif file for use with the Tesseract OCR engine. I can use this method to produce a compressed tif file... final BufferedImage bmp = ImageIO.read(new File("input.bmp")); ImageIO.write(bmp, "jpg", new File("output.tif")); This produces an empty tif file when the "jpg" is changed to tif as these files are dealt with in Java Advanced Imaging (JAI). How can I create an uncompressed tif image? Should I decompress the tif image produced from the above code or is there another way to handle the conversion process? Any examples provided would be

Scaling images with Java JAI

前提是你 提交于 2019-12-04 05:50:11
I have to scale an image with Java JAI. At the time now, I use the following code: private static RenderedOp scale(RenderedOp image, float scale) { ParameterBlock scaleParams = new ParameterBlock(); scaleParams.addSource(image); scaleParams.add(scale).add(scale).add(0.0f).add(0.0f); scaleParams.add(Interpolation.getInstance(Interpolation.INTERP_BICUBIC_2)); // Quality related hints when scaling the image RenderingHints scalingHints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); scalingHints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints