private boolean checkForActualAlpha(final BufferedImage src) {
        // to conserve memory, very large images may be read
        // in pieces.
        final int width = src.getWidth();
        final int height = src.getHeight();
        int nRowsPerRead = MAX_PIXELS_FOR_RGB / width;
        if (nRowsPerRead < 1) {
            nRowsPerRead = 1;
        }
        final int nReads = (height + nRowsPerRead - 1) / nRowsPerRead;
        final int[] argb = Allocator.intArray(nRowsPerRead * width);
        for (int iRead = 0; iRead < nReads; iRead++) {
            final int i0 = iRead * nRowsPerRead;
            final int i1 = i0 + nRowsPerRead > height ? height : i0 + nRowsPerRead;
            src.getRGB(0, i0, width, i1 - i0, argb, 0, width);
            final int n = (i1 - i0) * width;
            for (int i = 0; i < n; i++) {
                if ((argb[i] & 0xff000000) != 0xff000000) {
                    return true;
                }
            }
        }
        return false;
    }
Check an image to see if any of its pixels are non-opaque.

@param src a valid image
@return true if at least one non-opaque pixel is found.
src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffImageWriter.java