static double estimatePixelCount(final Image image, final double widthOverHeight) {
        if (image.getHeight() == HEIGHT_UNKNOWN) {
            if (image.getWidth() == WIDTH_UNKNOWN) {
                // images whose size is completely unknown will be in their own subgroups, so
                // any one of them will do, hence returning the same value for all of them
                return 0;
            } else {
                return image.getWidth() * image.getWidth() / widthOverHeight;
            }
        } else if (image.getWidth() == WIDTH_UNKNOWN) {
            return image.getHeight() * image.getHeight() * widthOverHeight;
        } else {
            return image.getHeight() * image.getWidth();
        }
    }
@Test
    public void testEstimatePixelCountWidthUnknown() {
        assertEquals( 10000.0, estimatePixelCount(img(100, WIDTH_UNKNOWN),  1.0    ), 0.0);
        assertEquals( 20000.0, estimatePixelCount(img(200, WIDTH_UNKNOWN),  0.5    ), 0.0);
        assertEquals(    12.0, estimatePixelCount(img(  1, WIDTH_UNKNOWN), 12.0    ), 0.0);
        assertEquals(230400.0, estimatePixelCount(img(360, WIDTH_UNKNOWN), 16.0/9.0), 0.0);
    }