Open OnlyFart opened 5 months ago
After a series of experiments, I found out that if execution goes along the first branch, then an error occurs. If according to the "else" branch, then everything works correctly
Hi!
With image.png
corresponding to the PNG in your SVG file, I’ve tested this small C code:
#include <cairo.h>
#include <stdio.h>
int main()
{
cairo_surface_t *surface = cairo_image_surface_create_from_png ("/tmp/image.png");
if (cairo_surface_status(surface) == CAIRO_STATUS_READ_ERROR)
{
printf("read error\n");
}
return 0;
}
It prints read error
, so the problem comes from Cairo, not CairoSVG.
Maybe this PNG is broken? Otherwise, you should report a bug to Cairo, there’s not much we can do for you here.
Hi!
With
image.png
corresponding to the PNG in your SVG file, I’ve tested this small C code:#include <cairo.h> #include <stdio.h> int main() { cairo_surface_t *surface = cairo_image_surface_create_from_png ("/tmp/image.png"); if (cairo_surface_status(surface) == CAIRO_STATUS_READ_ERROR) { printf("read error\n"); } return 0; }
It prints
read error
, so the problem comes from Cairo, not CairoSVG.Maybe this PNG is broken? Otherwise, you should report a bug to Cairo, there’s not much we can do for you here.
Yes, this png is broken...
IEND header not correct
At the same time, cairosvg is capable of dealing with this broken file if it goes along another branch)
This file can't covert to pdf. test.svg.zip
If remove image, then convert work success
Command:
cairosvg test.svg -o test.pdf
Result:
OSError: [Errno cairo returned CAIRO_STATUS_READ_ERROR: b'error while reading from input stream'] 10
OS: macos Version: 2.7.1