Skip to main content

Posts

Showing posts from September, 2015

Extracting embedded images from SVG

With Inkscape, one can open and edit PDF files. But when the PDF comes with embedded images, the resulting SVG keeps the images as an embedded base64 encoded data. I wanted to extract those embedded images from the resulting SVG. But I didn't want to use the "export bitmap" option on Inkscape to extract those images, as within this way I wouldn't really know the original resolution besides the fact that Inkscape would re-encode the image data. So I wrote this one line to extract all images from one SVG. i=1; grep data:image test.svg  | cut -d "," -f 2 | cut -d \" -f 1 |while read line ; do echo $line | base64 --decode >  $i.png ; i=$((i+1)); done