protected static BufferedImage toImage(Collection<Boolean> data) {
        Iterator<Boolean> iterator = data.iterator();
        int width = toInteger(getNextInteger(iterator));
        int height = toInteger(getNextInteger(iterator));
        if (width > 0 && height > 0) {
            BufferedImage image;
            if (width < MAX_WIDTH && height < MAX_HEIGHT) {
                image = new BufferedImage(width, height,
                                          BufferedImage.TYPE_INT_RGB);
            } else {
                errorMessage("Atkuriamas mažesnis " + MAX_WIDTH + "x" +
                             MAX_HEIGHT + " vietoj " + width + "x" + height +
                             "paveikslėlis");
                image = new BufferedImage(MAX_WIDTH, MAX_HEIGHT,
                                          BufferedImage.TYPE_INT_RGB);
            }
            for (int y = 0; y < height && y < MAX_HEIGHT; y++) {
                if (y % 20 == 0) {
                    Synchronizer.progress = y / (double) height;
                    Synchronizer.updateProgress();
                }
                for (int x = 0; x < width && x < MAX_WIDTH; x++) {
                    int color = toInteger(getNextInteger(iterator));
                    image.setRGB(x, y, color);
                }
            }
            return image;
        } else {
            errorMessage("Paveikslėlio dydis neigiamas: " + width + "x" +
                                                            height); 
            return null;
        }
    }