jai

RenderedImage to BufferedImage for multipage-tiff reading

徘徊边缘 提交于 2019-11-29 15:07:31
I am using JAI to load in multipage TIFF images File file = workArea[0]; SeekableStream s = new FileSeekableStream(file); TIFFDecodeParam param = null; ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param); //first page RenderedImage op1 = new NullOpImage(dec.decodeAsRenderedImage(0), null, OpImage.OP_IO_BOUND, null); BufferedImage pg1 = new BufferedImage(op1.getWidth(), op1.getHeight(), BufferedImage.TYPE_INT_RGB); pg1.getGraphics().drawImage((Image) op1, 0, 0, null); However, in the last line I get a runtime error of: Exception in thread "main" java.lang.ClassCastException:

How to combine two or many tiff image files in to one multipage tiff image in JAVA

陌路散爱 提交于 2019-11-29 04:23:34
I have 5 single page tiff images. I want to combine all these 5 tiff images in to one multipage tiff image. I am using Java Advanced Imaging API. I have read the JAI API documentation and tutorials given by SUN. I am new to JAI. I know the basic core java. I dont understand those documentation and turorial by SUN. So friends Please tell me how to combine 5 tiff image file in to one multipage tiff image. Please give me some guidence on above topic. I have been searching internet for above topic but not getting any single clue. So please guide me friends. Thanks in advance. Gilbert Le Blanc I

Pure Java alternative to JAI ImageIO for detecting CMYK images

拜拜、爱过 提交于 2019-11-29 01:18:13
问题 first I'd like to explain the situation/requirements that lead to the question: In our web application we can't support CMYK images (JPEG) since IE 8 and below can't display them. Thus we need to detect when someone wants to upload such an image and deny it. Unfortunately, Java's ImageIO won't read those images or would not enable me to get the detected color space. From debugging it seems like JPEGImageReader internally gets the color space code 11 (which would mean JCS_YCCK ) but I can't

How to achieve jpeg lossless?

六月ゝ 毕业季﹏ 提交于 2019-11-28 11:46:31
How to achieve jpeg-lossess in Java? ImageWriter writer = (ImageWriter) ImageIO.getImageWritersByFormatName("JPEG-LS").next(); ImageWriteParam param = writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionType("JPEG-LS"); writer.setOutput(ImageIO.createImageOutputStream(new File("C:\\Users\\RileyRen\\Desktop\\123.jpg"))); writer.write(null, new IIOImage(subBufferedImage, null, null), param); Will throw an exception: Exception in thread "main" java.lang.IllegalArgumentException: Unknown compression type! at javax.imageio.ImageWriteParam

Write swing component to large TIFF image using JAI

[亡魂溺海] 提交于 2019-11-28 08:57:12
问题 I have a large swing component to write to TIFF. The component is too large to load the TIFF in memory, so I either need to make a big BufferedImage which is backed by a disk-based WritableRaster (as mentioned here) or use JAI. JAI seems like the better answer, aside from the utter confusion of the project. Given that, can someone outline steps for writing my swing component to a tiled TIFF without running out of Memory? Image size will be maybe 10000x700 Ideally I would create some sort of

JAI and ImageIO for 64 bit Windows

只谈情不闲聊 提交于 2019-11-28 08:18:02
i searched JAI and ImageIO library for 64 bit windows, but i didn't find any version of these. Last 64 bit win vesion request on Java Bug tracking system 6-7 years ago. I think, jai's developers will not release any version for win64. :( My question is, can we build jai and imageio from their source for 64bit windows, is it possible? How? thanks a lot... JAI and JAI Image I/O have two parts from source language points of view, java and C/C++. The java part is free (as free beer) and you can download and compile from java.net, but this is java source, no matter architecture (x86, x64). The C/C+

RenderedImage to BufferedImage for multipage-tiff reading

做~自己de王妃 提交于 2019-11-28 08:15:11
问题 I am using JAI to load in multipage TIFF images File file = workArea[0]; SeekableStream s = new FileSeekableStream(file); TIFFDecodeParam param = null; ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param); //first page RenderedImage op1 = new NullOpImage(dec.decodeAsRenderedImage(0), null, OpImage.OP_IO_BOUND, null); BufferedImage pg1 = new BufferedImage(op1.getWidth(), op1.getHeight(), BufferedImage.TYPE_INT_RGB); pg1.getGraphics().drawImage((Image) op1, 0, 0, null); However,

Using Java Advanced Imaging with Maven

一笑奈何 提交于 2019-11-28 05:39:43
The JAI setup is quite tedious, involving multiple jars and environment variables. It would aid the project's portability quite a lot if I could add it as a regular Maven dependency. The POM snippet I'm using is <dependency> <groupId>com.sun.media</groupId> <artifactId>jai_imageio</artifactId> <version>1.1</version> </dependency> and the errors are [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) com.sun

Read region from very large image file in Java

[亡魂溺海] 提交于 2019-11-27 22:30:45
Is there a Java library that can read regions of very large image (e.g. JPEG) files (> 10,000 x 10,000 pixels) without keeping the whole image in memory. Or alternatively, which Java library is capable of handling very large image files with a minimum of overhead. Standard ImageIO allows you to read regions of (large) images without reading the entire image into memory first. Rectangle sourceRegion = new Rectangle(x, y, w, h); // The region you want to extract ImageInputStream stream = ImageIO.createImageInputStream(input); // File or input stream Iterator<ImageReader> readers = ImageIO

JAI vendorname == null

瘦欲@ 提交于 2019-11-27 15:03:28
So I finished coding my application to rotate TIFF images which required JAI to manipulate the TIFFs. It works fine when working under Eclipse, but whenever I build a fat jar for the library and then create one implementing that (per http://fjep.sourceforge.net/fjeptutorial.html ), when I do the java -jar Push.jar \path\to\dir, it runs up until it hits the part where it is compressing and saving: TIFFImageWriterSpi tiffspi = new TIFFImageWriterSpi(); ImageWriter writer = tiffspi.createWriterInstance(); //Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName("TIFF"); //ImageWriter