@Test
    public void test2svg() {
        int size = 8;
        BufferedImage pixelImg = ImgPixelWrapper.build()
                .setSourceImg("https://spring.hhui.top/spring-blog/css/images/avatar.jpg")
                .setBlockSize(size)
                .setPixelType(PixelStyleEnum.PIXEL_COLOR_AVG)
                .build().asBufferedImg();

        int w = pixelImg.getWidth(), h = pixelImg.getHeight();
        StringBuilder builder = new StringBuilder();
        String s = StrUtil.replace(SVG_START, "{width}", String.valueOf(w), "{height}", String.valueOf(h), "{BG_COLOR}", "white", "{FONT_COLOR}", "black");
        builder.append(s).append("\n");
        for (int i = 0; i < w; i += size) {
            for (int j = 0; j < h; j += size) {
                int color = pixelImg.getRGB(i, j);
                Color c = new Color(color, true);
                if (c.getRed() >= 250 && c.getGreen() >= 250 && c.getBlue() >= 250) {
                    continue;
                }
                String htmlColor = ColorUtil.int2htmlColor(color);
                builder.append(toRect(htmlColor, size, size, i, j)).append("\n");
            }
        }
        builder.append(SVG_END);
        System.out.println(builder);
        System.out.println("over");
        FileWriteUtil.saveContent(new File("/tmp/parseSvg-out2.svg"), builder.toString());
    }
png/jpeg -> svg

@author YiHui
@date 2023/1/16
plugins/image-plugin/src/test/java/com/github/hui/quick/plugin/test/feat/svg/SvgParseTest.java