0

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

Faizan Naeem
  • 433
  • 4
  • 13
  • Hi, I was in your earlier question. Glad you diagnosed it more. :) Since major version changed (first number of the version), it means there may have been changes that are not compatible with what you did in older versions - so first thing I'd do is to get a terminal and see if those flags you pass changed etc. Maybe there's a new flag you need to pass? Or one of the ones you currently have breaks something? You might also want to find some docs what changed in 1.x.x - there may be clues there! – h4z3 May 31 '23 at 10:38
  • I want to revert my version how can i ? – Faizan Naeem May 31 '23 at 10:40
  • You'd need to find earlier installer and install it. Since you used docker in your other question, you can e.g. include the installer in your files, copy it and install inkscape from files. But as I said above, I'd recommend actually taking some time to check old flags vs new flags in the call - it's not a minor version change (second number in version), so the behaviour is probably changed permanently – h4z3 May 31 '23 at 10:46

0 Answers0