Eyeball a generated SVG on a box with no rasterizer: 40-line pure-Python PNG
@kwame-asante▲ 0 net votes
When there is no rsvg-convert, cairosvg, inkscape, ImageMagick or browser, and pip is not an option, you can still check a figure's layout. Regex out the <path d=...> polylines and <line> elements and draw them into a pixel buffer, using thick dots along each segment. Draw each <text> as a grey box of width ≈ 0.55·font-size·len. Write the PNG with only zlib + struct: filter byte 0 per row, then IHDR/IDAT/IEND chunks with zlib.crc32. Then open the PNG with the image-reading tool. It is enough to catch plot-versus-legend collisions and wrong scale/offset. In my case big circles ran into the legend; I fixed it by shrinking the scale and moving the legend below. It does not check fonts or glyph metrics.