Inkscape does not actually embed the image files given

Bug #958371 reported by trlkly
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Medium
Unassigned

Bug Description

Inkscape version: 0.48.2
OS: Windows 7 Home Premium SP 1

Inkscape does not actually embed the files given it, but actually recompresses them. It removes any optimization applied to PNGs, which makes SVGs larger than they should be, but, far worse, it also recompresses any JPEGs, which actually destroys information. In the example below, I put in a JPEG encoded at 95% with 4:4:4 chroma, but the extracted file is always 75% with 4:2:2 chroma.

Attachment is a zip file including both of the original image files and an SVG that supposedly contains them. To extract the images, simply load the SVG, unmask the images (Object > Unmask > Release), and use Extensions > Images > Extract Image as intended. To verify that the problem is with embedding and not with the extension, you can open the SVG and manually decode the Base64 portions of the Data URIs. To verify it is not just my system, you can recreate the SVG file yourself with the included images.

Revision history for this message
trlkly (terrell-kelley) wrote :
Revision history for this message
trlkly (terrell-kelley) wrote :

Version of attachment's svg without mask.

su_v (suv-lp)
tags: added: bitmap importing
Revision history for this message
su_v (suv-lp) wrote :

> (…) it also recompresses any JPEGs,

Related to or duplicate of
Bug #871563 “JPG pasting in trouble with resolution”
<https://bugs.launchpad.net/inkscape/+bug/871563>

Apparently embedding linked bitmap images (JPEG) with 'Extensions > Images > Embed Images…' produces slightly better results than embedding JPEGs using internal routines (when importing or pasting).

I haven't found similar reports for PNG images.

Revision history for this message
su_v (suv-lp) wrote :

Reduced quality of imported compressed JPEG image when embedded on import visually reproduced (see attached screenshot) - this is the same issue as reported in bug #871563 (embedding via python script produces no visual artifacts in the embedded image).

> It removes any optimization applied to PNGs

Do you have a separate test case for this which you could attach?

Revision history for this message
su_v (suv-lp) wrote :

> Reduced quality of imported compressed JPEG image when embedded on import

Also reproduced with current trunk (r11093) on OS X Lion, with gtk2 2.24.10 and gdk-pixbuf2 2.24.0

Revision history for this message
trlkly (terrell-kelley) wrote :

> Do you have a separate test case for this which you could attach?

I can, but let me also make sure you understand that there was an example in my first attachment file. The original PNG is only 5 KB, but the extracted version is 14 KB. There is no visual difference, it's just that the SVG is larger than it needs to be.

But I can attach an SVG that just contains a PNG. The 24 KB (8-bit) PNG is embedded as an 81 KB (32-bit) PNG. Also included is an SVG where I used the python script. Like with the JPEG, the script properly embeds the PNG without recompression.

I chose an 8-bit PNG because the results are more dramatic that way, but I will also attach a 32-bit PNG in my next post.

Revision history for this message
trlkly (terrell-kelley) wrote :

Example with a 32-bit PNG, A 148KB PNG is embedded as a 184KB PNG. And, once again, embedding via the python script works correctly, and thus is included for comparison's sake.

Revision history for this message
jazzynico (jazzynico) wrote :

Confirmed on Windows XP, Inkscape revision 11205.

Core embedding encodes a pixbuffer (with the sp_embed_image() function), whereas the extension encodes the file directly.
But there are apparently other differences, since the Bitmap copy command (which also uses the internal function) produces an even larger file.

Note that JPG and PNG import both use sp_embed_image().

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.