Login  Register

Possible to access pixels without creating java.awt.image

Posted by Brian Willkie-2 on May 06, 2008; 12:11am
URL: http://imagej.273.s1.nabble.com/Possible-to-access-pixels-without-creating-java-awt-image-tp3696328.html

Hello,

Is it possible to create an ImageProcessor (one that accesses the  
pixels in a given tif file) without creating an instance of  
java.awt.Image?


        public ColorProcessor(Image img) {
                width = img.getWidth(null);
                height = img.getHeight(null);
                pixels = new int[width * height];
                PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pixels,  
0, width);
                try {
                        pg.grabPixels();
                } catch (InterruptedException e){};
                createColorModel();
                fgColor = 0xff000000; //black
                resetRoi();
        }

Thanks,
Brian