protected static BufferedImage getDestination(final ImageReadParam param,
                    final Iterator<ImageTypeSpecifier> imageTypes,
                    final int width, final int height) throws IIOException {
        iaeIfNull("imageTypes", imageTypes); //$NON-NLS-1$
        iaeIfEmpty("imageTypes", !imageTypes.hasNext()); //$NON-NLS-1$

        if ((long) (width * height) > (long) Integer.MAX_VALUE) {
            throw new IllegalArgumentException(
                            "width * height > Integer.MAX_VALUE!"); //$NON-NLS-1$
        }

        final Rectangle dst;
        ImageTypeSpecifier its = null;

        if (param != null) {
            final BufferedImage img = param.getDestination();

            if (img != null) {
                return img;
            }

            its = param.getDestinationType();
        }

        try {
            isValid: if (its != null) {
                while (imageTypes.hasNext()) {
                    if (its.equals((ImageTypeSpecifier) imageTypes.next())) {
                        break isValid;
                    }
                }
                throw new IIOException(Messages.getString("imageio.3", its)); //$NON-NLS-1$
            } else {
                its = imageTypes.next();
            }
        } catch (final ClassCastException ex) {
            throw new IllegalArgumentException(ex);
        }

        dst = new Rectangle(0, 0, 0, 0);
        computeRegions(param, width, height, null, new Rectangle(0, 0, 0, 0),
            dst);
        return its.createBufferedImage(dst.width, dst.height);
    }