2

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 where causing the application to crash after exporting to an executable jar.

It seems that the problem is imgScalr because it's the resize and rotation that are slow.

An 11.6MB nef file from a Nikon D300 takes 1 minute 35 seconds to resize to 20% and a minute 38 to rotate the image 90 degrees.

But this make no sense to me because these images are being rotated and resized as bufferedImages not as their original format. Could this be a size issue with imgScalr?

Apparently it has to do with the image color type. If I convert the images to RGB the resize and rotation go fast but the conversion to the RGB takes a long time. I am using ColorConvertOp to do the conversions.

Codeguy007
  • 891
  • 1
  • 12
  • 32

1 Answers1

1

It appears that the jrawio library is not the problem. The problem is the color format of the raw image. Scalr works much faster with ARGB or RGB color formats and if you convert the image to ARGB or RGB before modifying the image the modifications will go just as fast as the JPEGs. However the conversion itself takes as long as one of the modifications.

Codeguy007
  • 891
  • 1
  • 12
  • 32
  • ImgScalr actually converts the files to RGB before doing the resize, so that is why it takes so long. Just use a different sizing library, because ImgScalr just calls Java2D code. – le3th4x0rbot Jun 22 '13 at 14:34
  • Have you tried supplying a destination image to the ImageReadParam, using a more standard color/pixel format? Have a look at `ImageReader.getImageTypes(int)` for possible values, and `ImageReadParam.setDestination(BufferedImage)/setDestinationType(ImageTypeSpecifier)` to set the actual destination (type). Could potentially make things faster (or just move the time consuming part to the reading...). – Harald K Jun 22 '13 at 18:24
  • @Bailey what other sizing libraries are available. I know about JAI but what else is out there? – Codeguy007 Jun 22 '13 at 21:44
  • Feel free to try this [Java port of fzoom/ImageMagick'sresize.c](https://github.com/haraldk/TwelveMonkeys/blob/master/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java). Not sure how well it performs against ImgScalr, but it creates nice results. – Harald K Jun 22 '13 at 22:38