Hi All,

I’m trying to use imglib2 for some image processing. One thing I need to do is 
transform Img (actually ArrayImg) objects to BufferedImages. I’d also like to 
be able to transform those BufferedImages back into ArrayImg objects. For the 
most part I’m currently working with just PNG and JPEG (i.e. ARGB).

I think I found a way to convert an Img to BufferedImage, but I’m not sure this 
is the recommended method. So if anyone has a better recommendation, please let 
me know!! Here’s the method I found:

// Scala code, sorry Java folks.

import net.imglib2.img.display.imagej.ImageJFunctions

val imagePlus = ImageJFunctions.wrap(img, "")
val bufferedImage = imagePlus.getBufferedImage

How do I convert the buffered image back to an Img object? I saw this code at 
https://github.com/imglib/imglib/…/BufferedImageImg.java, but the resulting 
ArrayImg has dimensions of (height, width, 1) instead of the expected 
dimensions of (heigh, width, 3), so it doesn’t appear to be doing the right 
thing.

Thanks!

Brian



-- 
Brian Schlining
_______________________________________________
ImageJ-devel mailing list
ImageJ-devel@imagej.net
http://imagej.net/mailman/listinfo/imagej-devel

Reply via email to