public void exportAsImage() {
        final JDialog dlog = new JDialog();
        dlog.setTitle("Select Output Image Format");
        dlog.getContentPane().setLayout(new BorderLayout());
        dlog.setModal(true);

        JPanel ctrlPanel = new JPanel();
        ctrlPanel.add(new JLabel("Format:"));
        String writerNames[] = ImageIO.getWriterFormatNames();
        final JList writeList = new JList(writerNames);
        writeList.setSelectedIndex(0);
        writeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane scr = new JScrollPane(writeList);
        ctrlPanel.add(scr);
        dlog.getContentPane().add(ctrlPanel, BorderLayout.CENTER);

        JButton closeMe = new JButton("Close");
        closeMe.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                dlog.dispose();
            }
        });

        JButton okBut = new JButton("OK");
        okBut.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                dlog.dispose();
            }
        });

        JPanel butPanel = new JPanel();
        butPanel.add(closeMe);
        butPanel.add(okBut);
        dlog.getContentPane().add(butPanel, BorderLayout.SOUTH);
        dlog.pack();
        dlog.setVisible(true);

        String extensionToUse = (String) writeList.getSelectedValue();

        if (extensionToUse == null) {
            return;
        }

        File selectedFile = FileUtilities.selectFileForSave(this);
        if (selectedFile == null) {
            return;
        }


        int w = currentScaledWidth;
        int h = currentScaledHeight;
        int type = BufferedImage.TYPE_INT_RGB;  // other options
        BufferedImage dest = new BufferedImage(w, h, type);
        Graphics2D g2 = dest.createGraphics();

        // store level 0 only
        int maxLvls = 1;
        for (int i = 0; i < maxLvls; i++) {
            TransparentImageLevel level = getImageLevel(i);
            if (level != null && level.isVisible()) {
                level.reset();
                g2.drawImage(level.getImg(), 0, 0, w, h, null);
            }
        }
        g2.dispose();

        try {
            ImageIO.write(dest, extensionToUse, selectedFile);
        } catch (Exception e) {
            e.printStackTrace();
        }
        // since we blew away the grid, etc..
        updateNameTableSelection(page);


    }