static PDImageXObject convertPNGImage(PDDocument doc, byte[] imageData) throws IOException
    {
        PNGConverterState state = parsePNGChunks(imageData);
        if (!checkConverterState(state))
        {
            // There is something wrong, we can't convert this PNG
            return null;
        }

        return convertPng(doc, state);
    }
@Test
    void testImageConversionIntentIndexed() throws IOException
    {
        checkImageConvert("929316.png");

        try (PDDocument doc = new PDDocument())
        {
            InputStream in = PNGConverterTest.class.getResourceAsStream("929316.png");
            byte[] imageBytes = in.readAllBytes();
            PDImageXObject pdImageXObject = PNGConverter.convertPNGImage(doc, imageBytes);
            assertEquals(COSName.PERCEPTUAL, pdImageXObject.getCOSObject().getItem(COSName.INTENT));

            // Check that this image gets an indexed colorspace with sRGB ICC based colorspace
            PDIndexed indexedColorspace = (PDIndexed) pdImageXObject.getColorSpace();

            PDICCBased iccColorspace = (PDICCBased) indexedColorspace.getBaseColorSpace();
            // validity of ICC CS is tested in checkImageConvert

            // should be an sRGB profile. Or at least, the data that is in ColorSpace.CS_sRGB and
            // that was assigned in PNGConvert.
            // (PDICCBased.is_sRGB() fails in openjdk on that data, maybe it is not a "real" sRGB)
            ICC_Profile rgbProfile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
            byte[] sRGB_bytes = rgbProfile.getData();
            assertArrayEquals(sRGB_bytes, iccColorspace.getPDStream().toByteArray());
        }
    }