Kozea / CairoSVG

Convert your vector images
https://courtbouillon.org/cairosvg
GNU Lesser General Public License v3.0
752 stars 149 forks source link

Support bitmap masks #375

Open GabrielYudenich opened 1 year ago

GabrielYudenich commented 1 year ago

Hello to all, i have this issue happening some time now and i want to know how i can fix it

I'm trying to convert a SVG image to a PDF using Cairo, but it's really not working and everytime i got a broken PDF image

The SVG file and the PNG image are right here: Google drive

All of the text and everything on the image are broken on PNG

PNG:

gluck pdf_0_svg_image svg

Someone can help me? The code are very simple to convert but i always got the same error

svg2png(bytestring=svg_stream, scale=3, background_color='white', write_to=path_to_pdf)

Thank you in advance!

liZe commented 1 year ago

Hi!

CairoSVG doesn’t support bitmap masks, as the one used in your example. I don’t know if it’s even possible to do this with Cairo 😢️.

GabrielYudenich commented 1 year ago

Actually, i already did this in the past and worked pretty well

I had to change the tactics to do it what i want on my code, it worked but i really prefer this tactics with Cairo

If I'm not mistaken, only the second base64 inside the SVG content are not displaying on pdf

I have changed and saw all possibilities of the string who was opening the SVG was not encoding or sending this information to the Cairo but it's all working on my side

I have done it before with Cairo some months ago, but maybe an update created this bug

This is my first time reporting something on GitHub, i hope I'm not creating false bugs haha

Em ter., 27 de dez. de 2022 08:10, Guillaume Ayoub @.***> escreveu:

Hi!

CairoSVG doesn’t support bitmap masks, as the one used in your example. I don’t know if it’s even possible to do this with Cairo 😢️.

— Reply to this email directly, view it on GitHub https://github.com/Kozea/CairoSVG/issues/375#issuecomment-1365823488, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLQSSAB42HKYOWUQUFKP6DWPLFBHANCNFSM6AAAAAATJXD4A4 . You are receiving this because you authored the thread.Message ID: @.***>

liZe commented 1 year ago

If I'm not mistaken, only the second base64 inside the SVG content are not displaying on pdf

You’re right. The first one works because it’s a simple image (actually a use tag referencing a symbol tag including an image tag). The second one is an image applied as a mask onto a rectangle, it’s not a simple image, that’s why it doesn’t work.

GabrielYudenich commented 1 year ago

Yes!

In the past, i did a tool to remove some elements on the SVG of the PDF page and it has a similar SVG construction

I did 800 pages approximately with this method months ago and it all worked fine but now it's corrupting the pages

Actually any SVG (of mine) to PNG are giving this bug. Maybe something changed on the code?

Thank you for your support and help!

Em ter., 27 de dez. de 2022 08:27, Guillaume Ayoub @.***> escreveu:

If I'm not mistaken, only the second base64 inside the SVG content are not displaying on pdf

You’re right. The first one works because it’s a simple image (actually a use tag referencing a symbol tag including an image tag). The second one is an image applied as a mask onto a rectangle, it’s not a simple image, that’s why it doesn’t work.

— Reply to this email directly, view it on GitHub https://github.com/Kozea/CairoSVG/issues/375#issuecomment-1365833533, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLQSSAQHA73UTGBA5YQJIDWPLHDNANCNFSM6AAAAAATJXD4A4 . You are receiving this because you authored the thread.Message ID: @.***>

liZe commented 1 year ago

Actually any SVG (of mine) to PNG are giving this bug. Maybe something changed on the code?

I get the same problem with CairoSVG 2.2.0 that’s more than 4 years old. So, if something changed in the code, it changed a really long time ago!

I also tried Cairo 1.16.0 (instead of the "new" 1.17.x versions), it doesn’t change anything.

GabrielYudenich commented 1 year ago

I will try to see about my older files, if i changed something on my code but i pretty sure i was not change anything

About this bug on base64 not displaying on PNG. Is it possible to fix this in the future?

Thank you!

Em ter., 27 de dez. de 2022 às 08:49, Guillaume Ayoub < @.***> escreveu:

Actually any SVG (of mine) to PNG are giving this bug. Maybe something changed on the code?

I get the same problem with CairoSVG 2.2.0 that’s more than 4 years old. So, if something changed in the code, it changed a really long time ago!

I also tried Cairo 1.16.0 (instead of the "new" 1.17.x versions), it doesn’t change anything.

— Reply to this email directly, view it on GitHub https://github.com/Kozea/CairoSVG/issues/375#issuecomment-1365845407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLQSSG7NONOKHBVVWHUNRLWPLJT7ANCNFSM6AAAAAATJXD4A4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Gabe.

liZe commented 1 year ago

About this bug on base64 not displaying on PNG. Is it possible to fix this in the future?

CairoSVG is in maintenance mode, so this bug will probably not be fixed soon 😢️.