jai

Scale multi page TIFF Image in java

不羁的心 提交于 2019-12-19 11:59:35
问题 I want to change the height of multi page TIFF image so I am using below code snippet to scale it. But It returns just first page from the tiff file , I guess it converts it to JPEG image. How to retain all pages of the file?? public static byte[] scale(byte[] fileData, int width, int height) { System.out.println("width:::"+width+"::::height:::"+height); ByteArrayInputStream in = new ByteArrayInputStream(fileData); ByteArrayOutputStream buffer=null; BufferedImage img=null; BufferedImage

How to set icc color profile in Java and change colorspace

纵饮孤独 提交于 2019-12-18 13:54:33
问题 First, I would like to say I'm not an image processing specialist. I would like to convert image colorspace from one to another, and change icc color profile at the same time. I managed to do it using JMagick (the ImageMagick Java port), but no way in pure Java (even using JAI). 回答1: Use ColorConvertOp, this will do the color space conversion. You have several options to set a icc color profile. Either you use a predefined profile by using getInstance with the correct color space constant or

JAI vendorname == null

独自空忆成欢 提交于 2019-12-17 12:17:00
问题 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

JAI create seems to leave file descriptors open

a 夏天 提交于 2019-12-13 12:29:21
问题 I have some old code that was working until recently, but seems to barf now that it runs on a new server using OpenJDK 6 rather than Java SE 6. The problem seems to revolve around JAI.create. I have jpeg files which I scale and convert to png files. This code used to work with no leaks, but now that the move has been made to a box running OpenJDK, the file descriptors seem to never close, and I see more and more tmp files accumulate in the tmp directory on the server. These are not files I

java.util.ServiceConfigurationError: Provider could not be instantiated

走远了吗. 提交于 2019-12-13 07:23:16
问题 I have a .jp2 image file that I want to convert to .jpg . BufferedImage background = ImageIO.read(new File("images\\" + randNum + ".jp2")); ImageIO.write(background, "jpg", new File("images\\" + randNum + ".jpg")); I have got this exception : java.util.ServiceConfigurationError: javax.imageio.spi.ImageWriterSpi: Provider com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi could not be instantiated ... Caused by: java.lang.NoClassDefFoundError: com/github/jaiimageio/impl/common/PackageUtil .

java.lang.ClassNotFoundException: it.geosolutions.jaiext.range.Range

会有一股神秘感。 提交于 2019-12-12 06:00:56
问题 I recently started my first program with GeoTools in which i was also using JAI- Java Advanced Imaging. I found following error Exception in thread "main" java.lang.NoClassDefFoundError: it/geosolutions/jaiext/range/Range at it.geosolutions.jaiext.crop.CropDescriptor.(CropDescriptor.java:62) at it.geosolutions.jaiext.crop.CropSpi.updateRegistry(CropSpi.java:56) at javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2056) at javax.media.jai.ThreadSafeOperationRegistry

Unsupported image format. May need to install JAI Image I/O package

橙三吉。 提交于 2019-12-12 03:44:59
问题 I'm trying to convert an image file to text using tess4j maven dependency. Dependency in pom.xml:- <!-- OCR dependency --> <dependency> <groupId>net.sourceforge.tess4j</groupId> <artifactId>tess4j</artifactId> <version>3.4.0</version> <exclusions> <exclusion> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> </exclusion> <exclusion> <groupId>net.sourceforge.lept4j</groupId> <artifactId>lept4j</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>net.java

i am not able to read tiff images

懵懂的女人 提交于 2019-12-12 00:58:29
问题 Here is my code. I am pasting an image over another image. This is working fine for .gif and .jpg but getting Null Pointer Exception for reading tiff images. import java.awt.*; import java.awt.image.*; import java.io.*; import javax.media.jai.*; import javax.imageio.*; public class Paint { public static void main ( String args[] ) { try { // Create output file OutputStream outStream = new FileOutputStream( "C:\\Users\\JavaPrg\\images\\image12.tif" ); // Load specified foreground and

Add/remove ImageReader from jar to ImageIO-registry

感情迁移 提交于 2019-12-11 13:39:32
问题 In jar jai_imageio.jar there is class: com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader So i add jai_imageio.jar (and jai_core.jar, jai_codec.jar) to classpath. But this class seems not to be accessable for ImageIO. So this code: ImageIO.scanForPlugins(); IIORegistry.getDefaultInstance().registerApplicationClasspathSpis(); Iterator<ImageReader> ir = ImageIO.getImageReadersByFormatName("jpeg"); while(ir.hasNext()) { ImageReader r = ir.next(); System.out.println("can read raster: " +

JAI Change JPEG Resolution

给你一囗甜甜゛ 提交于 2019-12-11 12:28:45
问题 I am having difficulty using the Java JAI (Java Advance Imaging) API to change the resolution of a JPEG image from lets say 1024x800 to 512x400. I have played around with the API and keep getting stream or java.lang.OutOfMemory exceptions. Anyone with a working example. 回答1: Here's a working example, supplied on an "as is" basis with no warranty :) BufferedImage scaleImage(BufferedImage sourceImage, int scaledWidth) { float scale = scaledWidth / (float) sourceImage.getWidth(); int