Converting embedded images to PNG/JPG?

Asked by unfa

I've cut-and-pasted a lot of image slices from GIMP directly into Inkscape - the SVG file is now 60 MB.

The source JPGs I pasted the slices from were just 11 MB, but I guess it was rather transfered as PNG, so that might be the size increase. However I suspect it might be even worse - maybe Inkscape emeds the pasted images as BMP, or another uncompressed format that is very ineficcient for storage?

I'd like to have a way to encode the embeded images to JPG (determinig the target quality and discarding the alpha channel) so the SVG weights less.
I don't need lossless quality for this project, but smaller total size would be nice.

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Hachmann (marenhachmann) said :
#1

Hi unfa,

there's currently no shortcut for this. The images (if embedded, and not linked), are saved base64 encoded in the SVG, and if you paste from Gimp, you get the file format gimp puts into the clipboard (you can check the format by selecting one image, then opening the xml editor and looking into the data attribute).

What might work (not tested) could be to:

1. Use the extension that 'extracts images' to save them as a link (not embedded).
2. Then to use a tool like imagemagick (mogrify command for batch mode) to convert those to jpg
3. Either rename the jpg files with the wrong extension name (i.e. png), so the names are identical to those saved in the SVG, or manually edit the SVG file and replace .png with .jpg, to get the same result.
4. Use the extension that 'embeds all images' to re-embed the pictures.

(or you write an extension that does it)

Kind Regards,
 Maren

Can you help with this problem?

Provide an answer of your own, or ask unfa for more information if necessary.

To post a message you must log in.