public static Image getInstance(Properties attributes) throws BadElementException, MalformedURLException, IOException { String value; Image image = Image.getInstance(attributes.getProperty(ElementTags.URL)); int align = 0; if ((value = attributes.getProperty(ElementTags.ALIGN)) != null) { if (ElementTags.ALIGN_LEFT.equals(value)) align |= Image.LEFT; else if (ElementTags.ALIGN_RIGHT.equals(value)) align |= Image.RIGHT; else if (ElementTags.ALIGN_MIDDLE.equals(value)) align |= Image.MIDDLE;
public static Image getInstance(URL url) throws BadElementException, MalformedURLException, IOException { InputStream is = null; try { is = url.openStream(); int c1 = is.read(); int c2 = is.read(); is.close();  is = null; if (c1 == 'G' && c2 == 'I') { return new Gif(url); } if (c1 == 0xFF && c2 == 0xD8) { return new Jpeg(url); } if (c1 == Png.PNGID[0] && c2 == Png.PNGID[1]) { return new Png(url); } throw new IOException(url.toString() + " is not a recognized imageformat.");
    public static Image getInstance(Properties attributes) throws BadElementException, MalformedURLException, IOException {        String value;        Image image = Image.getInstance(attributes.getProperty(ElementTags.URL));        int align = 0;        if ((value = attributes.getProperty(ElementTags.ALIGN)) != null) {            if (ElementTags.ALIGN_LEFT.equals(value)) align |= Image.LEFT;            else if (ElementTags.ALIGN_RIGHT.equals(value)) align |= Image.RIGHT;            else if (ElementTags.ALIGN_MIDDLE.equals(value)) align |= Image.MIDDLE;        }        if ((value = attributes.getProperty(ElementTags.UNDERLYING)) != null) {            if (new Boolean(value).booleanValue()) align |= Image.UNDERLYING;        }        if ((value = attributes.getProperty(ElementTags.TEXTWRAP)) != null) {            if (new Boolean(value).booleanValue()) align |= Image.TEXTWRAP;        }        image.setAlignment(align);        if ((value = attributes.getProperty(ElementTags.ALT)) != null) {            image.setAlt(value);        }        String x;        String y;        if (((x = attributes.getProperty(ElementTags.ABSOLUTEX)) != null)        && ((y = attributes.getProperty(ElementTags.ABSOLUTEX)) != null)) {            image.setAbsolutePosition(Float.parseFloat(x + "f"), Float.parseFloat(y + "f"));        }        if ((value = attributes.getProperty(ElementTags.PLAINWIDTH)) != null) {            image.scaleAbsoluteWidth(Float.parseFloat(value + "f"));        }        if ((value = attributes.getProperty(ElementTags.PLAINHEIGHT)) != null) {            image.scaleAbsoluteHeight(Float.parseFloat(value + "f"));        }        if ((value = attributes.getProperty(ElementTags.ROTATION)) != null) {            image.setRotation(Float.parseFloat(value + "f"));        }        return image;    }