Only link bitmap images when user requests it

Bug #415374 reported by Lars Noodén on 2009-08-18
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Wishlist
Krzysztof Kosinski

Bug Description

PNG images embedded in SVGs show up fine in Inkscape but not in Opera, Firefox or Safari on OS X, nor on Opera, Firefox or Konqueror on Debian GNU/Linux. The non-PNG components are rendered just fine. The bitmap is not rendered.

This one had the bit map added via import on the file menu:
http://www-personal.umich.edu/~lars/OpenBSD/net5501-jp.svg

This one had the bit map added by cut and paste from gimp:
http://www-personal.umich.edu/~lars/OpenBSD/net5501-j.svg

Tags: svg Edit Tag help

Related branches

su_v (suv-lp) wrote :

Non of these SVG files have bitmaps embedded, they have linked images

       sodipodi:absref="/home/lars/Desktop/pastedpic_08182009_160434.png"
       xlink:href="pastedpic_08182009_160434.png"

which cannot be displayed if the referenced bitmap files do not exist (e.g. here on my laptop). If you want to embed an image use the command 'Effects > Images > Embed Images…'

Proposing to convert bug report to a question.

bbyak (buliabyak) on 2009-08-18
Changed in inkscape:
status: New → Invalid
Lars Noodén (larsnooden) wrote :

Then it's a UI problem. The import and the cut-paste do not make clear that the file is linked instead of embedded.

Changed in inkscape:
status: Invalid → New
Lars Noodén (larsnooden) wrote :

Or, if it's not the UI being unclear about the linking, then it's a problem elsewhere.

A regular SVG file should, when it is saved, contain all the data in one file.

tags: removed: browser png www
Pablo Trabajos (pajarico) wrote :

> Then it's a UI problem. The import and the cut-paste do not make clear that the file is linked instead of embedded.
The UI already does warn you of this. Select an image and look at the status bar: if the file is linked it shows the path, if it's embedded it shows "Image embedded in layer X".

> A regular SVG file should, when it is saved, contain all the data in one file.
And to me you're thinking the other way around. It is you who have to tell Inkscape to embed them. By default, files are linked instead of embedded. This has at least two advantages:
- Image files are independent and can be edited with any bitmap editor.
- The size of the SVG file is much lower which means is faster to load and save.

If you plan to send this file to someone and need to embed the bitmaps use Extensions->Images->Embed Images.

I'n my opinion, this bug is not valid.

su_v (suv-lp) wrote :

<http://www.w3.org/TR/SVG11/struct.html#ImageElement>

"The 'image' element indicates that the contents of a complete file are to be rendered into a given rectangle within the current user coordinate system. The 'image' element can refer to raster image files such as PNG or JPEG or to files with MIME type of "image/svg+xml". Conforming SVG viewers need to support at least PNG, JPEG and SVG format files.

[…]

The resource referenced by the 'image' element represents a separate document which generates its own parse tree and document object model (if the resource is XML). Thus, there is no inheritance of properties into the image."

Lars Noodén (larsnooden) wrote :

Under which menu can "Extensions->Images->Embed Images" be found?

As far as whether the bitmapped is embedded or linked, even the Object->Object Properties menu gives no indication that the image is a link to an external bitmap.

File->Preferences and Document Properties and File->Inkscape Preferences
 don't say anything about linking.

If that is the way Inkscape works with objects cut-pasted or imported, then it would be helpful to have some indication in the menus or preferences.

su_v (suv-lp) wrote :

1) Embed function:
Inkscape 0.46: 'Effects > Images > Embed All Images'
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Effects-Images.html>
Inkscape 0.47pre: 'Extensions->Images->Embed Images…'

2) image properties:
- select the image and read the status line: all info (linked, embedded, size is displayed for the currently selected image)
- 'Image Properties' (right-click on image) shows the URL for linked images
- 'Edit > XML Editor…', compare linked (xlink:href="path_to_your_image_file.png") and embedded (xlink:href="data:image/PNG;base64,...") image in the xml tree viewer

3) If you think the UI needs to be improved, it would be helpful to attach a mockup.

su_v (suv-lp) wrote :

forgot to add the link to <http://tavmjong.free.fr/INKSCAPE/MANUAL/html/File-Import.html>:
"By default bitmap images are not stored inside the Inkscape SVG file. Only references are stored. If you move your bitmap files, the references will be broken. You can embed the images inside the SVG file by using the Embed Images effect. See the section called “Embed All Images” in Chapter 18, Effects. "

Pablo Trabajos (pajarico) wrote :

Thanks ~suv for posting what I was going to write myself :)
Lars: I see that you're using 0.46. "Effects" menu entry has turned into "Extensions"as ~suv points out.

Lars Noodén (larsnooden) wrote :

Thanks suv and Pablo. This is a case of obvious-once-you-know.

Regarding the UI. I'm not sure where information could be added without cluttering it. Maybe during the save dialog there could be a check box to embed the images. That's what I thought the difference would be between "Inkscape SVG" and "Plain SVG"

Attached is one *possible* way to consider showing the choice of embedding the images. Nothing to be jumped into without a lot of thought, however.

Lars Noodén (larsnooden) wrote :

Perhaps the choice shown in the attachment should only be offered in Save-As rather than plain Save.

http://launchpadlibrarian.net/30482821/snapshot1.png

summary: - PNG bitmaps embedded in SVGs not viewable in browsers
+ Include an option to embedd bitmaps in "Save As"
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed

> Perhaps the choice shown in the attachment should
> only be offered in Save-As rather than plain Save.
Yes, I prefer it that way too. You can un-embed images but once you've embedded them it's a pain to undo the operation.

> compare linked (xlink:href="path_to_your_image_file.png")
> and embedded (xlink:href="data:image/PNG;base64,...")
I think this can be made better. If I recall correctly, in the embedded case, the user is exposed even to the binary data contained inside that file, which is absurd. A simple label "<embedded>" would work much better.

Lars Noodén (larsnooden) wrote :

Other ways to tidy up linked / embedded bitmaps would be to have a single folder for each 'document' containing the SVG body and any sub documents, like GIFs, JPEG, PNG, etc.

summary: - Include an option to embedd bitmaps in "Save As"
+ Linking on paste causes unexpectedly broken images
summary: - Linking on paste causes unexpectedly broken images
+ Include an option to embedd bitmaps in "Save As"
summary: - Include an option to embedd bitmaps in "Save As"
+ Include an option to embed bitmaps in "Save As"
Krzysztof Kosinski (tweenk) wrote :

Fixed in 9143 - the default is now to embed the image, but an option is provided for linking if applicable.

summary: - Include an option to embed bitmaps in "Save As"
+ Only link bitmap images when user requests it
Changed in inkscape:
status: Confirmed → Fix Committed
assignee: nobody → Krzysztof Kosinski (tweenk)
su_v (suv-lp) on 2010-03-05
Changed in inkscape:
milestone: none → 0.48
jazzynico (jazzynico) on 2010-08-24
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments