Example usage for java.awt.image RenderedImage getMinX

List of usage examples for java.awt.image RenderedImage getMinX

Introduction

In this page you can find the example usage for java.awt.image RenderedImage getMinX.

Prototype

int getMinX();

Source Link

Document

Returns the minimum X coordinate (inclusive) of the RenderedImage.

Usage

From source file:org.gbif.portal.util.image.ImageUtils.java

/**
 * Return true if the URL resolves to an image (rather than e.g. a web
 * page or application launcher.// w  w  w . j ava  2 s. c  o m
 *
 * @param url
 * @return true if image is loadable
 */
public static boolean isImageLoadable(String url) {
    try {
        RenderedImage image = ImageIO.read(new URL(url));
        image.getMinX();
    } catch (Exception e) {
        return false;
    } catch (Throwable e) {
        logger.warn("JAI is not functioning correctly - Ignoring: " + e.getMessage());
        // happens when the JAI is not working.... no reason to know it is bust
        return true;
    }
    return true;
}