Reputation: 515
This is my code using for converting svg to png and return it on browser.
svgchart = chart_pygal.render()
inkscape_process = subprocess.Popen(['inkscape', '-z', '-e', '-', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
png_data, error = inkscape_process.communicate(input=svgchart)
png_io = BytesIO(png_data)
return send_file(png_io ,mimetype='image/png', download_name=image_name+'.png', as_attachment=True)
It was working fine with version of inkscape 0.92.1 but I have updated the version to 1.2.2 now it has stopped working as expected the image shows error when i open it .
sorry photos can not open this file because the format is currently unsupported, or the file is curropt
Upvotes: 1
Views: 42