*  @param width the width of the thumbnail (use -1 for actual width)
     *  @param height the height of the thumbnail (use -1 for actual height)
     *  @return the image data
     *  @throws IOException if a network error occurs
     *  @since 0.13
     */
    public byte[] getImage(String title, int width, int height) throws IOException
    {
        // @revised 0.24 BufferedImage => byte[]

        // this is a two step process - first we fetch the image url
        title = title.replaceFirst("^(File|Image|" + namespaceIdentifier(FILE_NAMESPACE) + "):", "");
        StringBuilder url = new StringBuilder(query);
        url.append("prop=imageinfo&iiprop=url&titles=File:");
        url.append(URLEncoder.encode(normalize(title), "UTF-8"));
        url.append("&iiurlwidth=");
        url.append(width);
        url.append("&iiurlheight=");
        url.append(height);
        String line = fetch(url.toString(), "getImage");
        String url2 = parseAttribute(line, "url", 0);

        // then we use ImageIO to read from it
        logurl(url2, "getImage");
        URLConnection connection = new URL(url2).openConnection();
        setCookies(connection);
        connection.connect();
        // there should be a better way to do this
        BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int c;
        while ((c = in.read()) != -1)
            out.write(c);
        log(Level.INFO, "Successfully retrieved image \"" + title + "\"", "getImage");
        return out.toByteArray();
    }