javax.imageio

stitch images together in java

↘锁芯ラ 提交于 2019-12-07 12:25:28
问题 I'm trying to stitch some images together using java. I have a bunch of images I'd like to stitch together and they are all the same dimensions so it's really just a question of lining them up next to each other I suppose. I have it working but it's very slow and probably very memory intensive. I'm wondering if there's an easier way: public static void main(String[] args) throws IOException { int dim = 256; BufferedImage merged = null; for(int y = 0; y<10;y++) { for(int x = 0; x<10;x++) { URL

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)

Java - Multithreading with ImageIO

给你一囗甜甜゛ 提交于 2019-12-07 06:10:31
I have a program that loads slowly, which I guess is due to the amount of image resources I have to load at the beginning. I thought multi-threading would help, but now I'm not so sure. Here is my automatic multi-threading method. private static Thread[] t; private static int currentThreads; public static void loadWithThreads(Object[] array, IntegerRunnable r) { final int threads = Runtime.getRuntime().availableProcessors(); t = new Thread[threads]; for (int i = 0; i < threads; i ++) { t[i] = new Thread("HMediaConverter") { final int id = currentThreads; int items = (array.length / threads) *

Java BufferedImage saves with unwanted background color

放肆的年华 提交于 2019-12-07 03:13:15
问题 Thanks ahead of time for the help Description: The program draws, displays, and saves an image. It works as following: the object itself extends Frame. In the constructor, the object creates a BufferedImage, and calls a method that draw onto that image. Then, it displays the image onto the Frame. Finally, it saves the image into a file (I don't care what format it uses). The main program creates the object, which does the rest. Problem: The saved file always has a colored background! This is

Using URL or File (in ImageIO.read)

。_饼干妹妹 提交于 2019-12-06 16:14:49
问题 I made an application that uses several images. I have 2 ways to run my app: - press run in idea - make a fat jar file and run it from console java -jar app.jar If I want to run it from Idea I have to use: BufferedImage backgroundImage = ImageIO.read(new File("res/field.png")); instead of BufferedImage backgroundImage = ImageIO.read(getClass().getClassLoader().getResource("res/field.png")); <- that's what I have to use in jar file case Why? I thought that they're about the same. Is there any

iOS4 calling ImageNamed: still leak or cause memory issue?

一世执手 提交于 2019-12-06 13:49:16
问题 So apparently, my app crashes on ipod 2nd generation due to low memory issue. What I do was calling image on each view within scrollView + pageControl when user scrolls. And app crashed when it reached a particular point after got memory warning. I tried to free up view when I got warning but it still caused crash. I googled about ImageNamed: and apparently there was issue within this api call, but most article said it was fixed in recent iOS version. I fixed this problem with calling image

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

Write tiled output of TIFF, using ImageIO in Java

假装没事ソ 提交于 2019-12-06 08:29:50
问题 What I have is a a large number of frames that need to be placed together in a larger image (like a mosaic). The required positions of the images are known. There are a very large number of images so loading them all into memory is impractical at best. Based on some other answers here I was able to override the methods in RenderedImage (specifically getData(rect) ) to load in the appropriate data and return it. This works just fine, however the image writer is always calling getData and