public int[] getPixelValues(byte[] imageBytes) {

        PngReaderInt reader = new PngReaderInt(new ByteArrayInputStream(imageBytes));
        validateImageType(reader);
        int[] pixels = new int[reader.imgInfo.cols * reader.imgInfo.rows];
        int rowNumber = 0;
        while (reader.hasMoreRows()) {
            ImageLineInt row = reader.readRowInt();
            int[] rowValues = row.getScanline();
            System.arraycopy(rowValues, 0, pixels, rowNumber * reader.imgInfo.cols, rowValues.length);
            rowNumber++;
        }
        reader.close();

        return pixels;
    }
public int [ ] getPixelValues ( byte [ ] imageBytes ) { PngReaderInt reader = new PngReaderInt ( new ByteArrayInputStream ( imageBytes ) ) ; validateImageType ( reader ) ; int [ ] pixels = new int [ reader . imgInfo . cols * reader . imgInfo . rows ] ; int rowNumber = 0 ; while ( reader . hasMoreRows ( ) ) { ImageLineInt row = reader . readRowInt ( ) ; int [ ] rowValues = row . getScanline ( ) ; System . arraycopy ( rowValues , 0 , pixels , rowNumber * reader . imgInfo . cols , rowValues . length ) ; rowNumber ++ ; } reader . close ( ) ; return pixels ; }
Get the pixel values of the image as 16 bit unsigned integer values

@param imageBytes image bytes
@return 16 bit unsigned integer pixel values