public static boolean hasImageFileExtension(final String fileName) {
        if (fileName == null) {
            return false;
        }

        final String normalizedFileName = fileName.toLowerCase(Locale.ROOT);

        for (final AbstractImageParser<?> imageParser : AbstractImageParser.getAllImageParsers()) {
            for (final String extension : imageParser.getAcceptedExtensions()) {
                if (normalizedFileName.endsWith(extension.toLowerCase(Locale.ROOT))) {
                    return true;
                }
            }
        }

        return false;
    }
Attempts to determine if a file contains an image recorded in a supported graphics format based on its file-name extension (for example "&#46;jpg",
"&#46;gif", "&#46;png", etc&#46;).

@param fileName A valid string representing name of file which may contain an image.
@return true if the file name has an image format file extension.
src/main/java/org/apache/commons/imaging/Imaging.java