Image properties dialog enhancements
- 1 Image properties dialog enhancements
- 1.1 Current Status
- 1.2 Summary
- 1.3 Proposal
- 1.4 Image Properties Dialog Re-design
- 1.5 Smart image re-linking
- 1.6 Manual selection of relative or absolute paths
- 1.7 Linked vs. Embedded
- 1.8 Image Resolution
- 1.9 General Benefits of this change
- 1.10 TODO
Image properties dialog enhancements
This blueprint is no more in a blueprint state.
The code is currently in a branch. The main features were added, but finishing, testing, reviewing and polishing are needed to merge it into trunk.
- The current 0.48 version uses file:// before the path in xlink:href attributes and the path is ASCII encoded. Imagelink uses the path directly (relative and absolute path) and keeps all non-ASCII characters non encoded. See http://www.w3.org/TR/xlink/#link-locators --JazzyNico 07:31, 11 July 2010 (UTC)
- According to http://www.w3.org/TR/SVG/linking.html#IRIReference, we can use IRIs instead of URIs in xlink:href. Therefore, file:// and ASCII conversion are not required.--JazzyNico 18:13, 12 July 2010 (UTC)
- Probably not a problem, since sodipodi:abref is already an IRI. There no reason to have two different kind of path. I've tested the imagelinks IRIs with some Save As formats which extract images (Gimp XCF and SVG+media), and noticed no issue.--JazzyNico 19:46, 4 November 2010 (UTC)
- Imagelink can't build on Windows versions: relink.cpp uses gtk 2.18+ features (gtk_widget_set_can_focus) and Windows devlibs currently use gtk 2.16.6 (2.18 shows UI rendering issues). --JazzyNico 19:15, 12 July 2010 (UTC)
Initial code replaced with the patch in https://bugs.launchpad.net/inkscape/+bug/170225
(Needs to be tested with ASCII and non-ASCII characters.)
- 1 - Save your document, drop an image from a subdirectory on the canvas, select "link", see that the link should now be relative.
- 2 - Do not save the document, import an image on the canvas, the link is absolute, save the document near the image, the image link should be updated with a relative link.
- 3 - Move a file with relative links to a place where they should become absolute.
- 4 - Move a file with absolute links to a place where they should become relative.
- 5 - Manually relink image (with the image properties dialog) to relative or absolute images.
status: test in progress
status: features are here, need to polish the UI (icons in message dialogs, better text padding...)
scenario: create a document with linked images, save this svg. Move the svg to another folder. reopen it, the relinking tool appears and help you relink the broken images.
- do not show an alert dialog when relinking is finished, prefer the status bar ?
- Yes, when relinking is a success. If not, I think we should show an error dialog (needs confirmation with HIG).--JazzyNico 07:31, 5 November 2010 (UTC)
- when opening a file with a broken link, the alert dialog doesn't show well the names of missing files.
- (--JazzyNico 18:14, 11 July 2010 (UTC)) on Ubuntu 10.04, libgtk 2.20.1-0ubuntu2, inkscape crashes when opening the moved file with the following error:
- Program received signal SIGSEGV, Segmentation fault.
- 0x00778f63 in IA__gtk_label_new (str=0x1 <Address 0x1 out of bounds>) at /build/buildd/gtk+2.0-2.20.1/gtk/gtklabel.c:1397
- 1397 /build/buildd/gtk+2.0-2.20.1/gtk/gtklabel.c: Aucun fichier ou dossier de ce type.
- in /build/buildd/gtk+2.0-2.20.1/gtk/gtklabel.c
- (gdb) bt
- 0 0x00778f63 in IA__gtk_label_new (str=0x1 <Address 0x1 out of bounds>)
- at /build/buildd/gtk+2.0-2.20.1/gtk/gtklabel.c:1397
- 1 0x080bfab9 in Relink::relink_dialog (this=0xb4804e40) at relink.cpp:328
- 2 0x0808fb64 in SPDocument::_updateDocument (this=0x8f36e00)
- at document.cpp:1027
- GtkWidget * lbl2 = gtk_label_new(transform_char(SP_OBJECT_REPR(*it)->attribute("xlink:href")));
- --JazzyNico 07:31, 5 November 2010 (UTC) on Windows XP (but probably on other systems too), Inkscape crashes when the link become broken while the document is still open (ie. if the linked image moves):
- 1. Open a new document.
- 2. Import an image.
- 3. Save the document.
- 4. Rename (file system) the image.
- 5. Move or resize the image in Inkscape to refresh it => crash.
- Related, but a bit different:
- 1. Open a new document.
- 2. Save it.
- 3. Import an image.
- 4. Rename (file system) the image => the image is not correctly refreshed with :the broken link image.
- 5. Save the document.
- 6. Reload the document => crash.
Image propriety window
scenario : right click on an image of the canvas, select image properties. A new window should allow you to see the image thumbnail and infos, choose another image, embed the image, reset ratio.
status: code started, not finished
TODO: (refering to the mockup on this page)
Organizing linked bitmap images is quite a hassle at the moment. When a bitmap file is renamed or moved to a different location, the corresponding bitmap links need to be changed manually one by one in Inkscape, involving a tedious copy and paste process for the filenames. This can be improved. This is an alternative to the method proposed in the article Linked bitmap manager.
The proposal is to add some minor enhancements to the existing image properties dialog, in order to improve its usability and solve broken links in an easy and automated way.
The first thing that has to be solved is the inconsistency in absolute/relative linking. At the moment all the images are linked with absolute paths, and that can be very inconvenient when working on the same file over a network. The images in the same directory than the SVG file should be linked with relative paths, and so the images in children directories. This condition can be extended to folders contained by the same parent folder that contains the SVG.
That would solve common problems like broken links if the file was created or is retrieved from a remote machine over a samba mount in linux, for instance.
Another common situation where absolute links are useless is a project retrieved from a backup. Again, all files have to be re-linked. So in the first place, fixing the absolute/relative linking will solve a lot of broken links.
However, that wouldn't fix all the broken links, and there are several situations where moving or renaming a linked file will result in a broken link, so another strategy should be prepared for that.
As it would discussed in the mailing list and related bug reports, the lack of a browse button in the image properties dialog makes it too tedious to re-link missing images, so adding that button would make things easier.
But having dozens of broken links would be still a hassle even having that button, so a "smart re-linking" strategy would be handy.
Adding a modal warning about broken links would be excessive since we already have a pretty visible way to display that there are missing bitmaps, so the focus should be put on providing an automated way to resolve broken links using a single manual replacement. As it was expressed earlier, a proper management of absolute and relative links would help with this task.
Image Properties Dialog Re-design
One of the most annoying things about the Image Properties dialog is that one window is opened for each image. That window should be re-utilized and be dockable. When the user selects another image, its information should fill the same properties window, not a new one. This dialog should be also accessible from the Object menu (like the object properties dialog), not only from the context menu of a selected image.
At the top there's an area that shows general information about the image, along with a thumbnail. This will give a glimpse about the image we're working on.
The URL field willbe accompained by a browse button for easy image re-linking. The URL text can be rendered red if the link is broken, giving a visual hint to the user that the path isn't correct.
I added radio buttons for selecting if the image is linked or embedded, since that is part of the image properties and it would make sense to put it in that dialog instead of a separate extension.
The fields for the dimensions of the image were preserved, adding a units selector and a proportional transformation lock.
The position fields were removed, since they are not (from the user point of view) part of the image properties, but an attribute of the object on the document. It isn't likely that a user will set the position of the image object on the document from a window that covers it, He will probably use the tool controls bar selectors instead.
An "advanced options" area was added. It lets the user enter the object ID, change the resolution of the image and use the original image's aspect ratio.
- Comment: What about adding a checkbox in the section image source, just below the edit control URL named Relative and to display the (on-the-fly-calculated) commun URL prefix (between the linked image and the Inkscape file) in a grey font? Best regards --Uncopy 10:52, 27 October 2009 (UTC)
- Comment: The radio buttons should be for absolute/relative, and for embedded/linked there should be a push button that says "embed" or "extract..." based on the state of the image. Embedded/linked cannot be a radio button, because switching to "linked" needs to bring up a file browser. Doing so in response to radio button change breaks all the interface guidelines I know. --Tweenk 19:31, 5 March 2010 (UTC)
- Comment: I'm ok with adding the relative/absolute switch. My original proposal was to do it kind of automatically, but I can see that it can be really problematic.
Regarding the Embedded/linked thing, the original proposal considers "linked" as the default importing strategy. This has been changed recently in inkscape but I think it's plain wrong. Embedding always and then extracting contributes to having duplicates of the original images everywhere. I think that embedding should be the default for the "make bitmap copy" command, and in that case the extract command should make sense. The original proposal doesn't go against that practice either: if the image is already embedded, the file browser is hidden. If you click on the "linked" radio button, then the extract dialog would pop up. We must, however, find a way to make all the situations co-exist nicely: linked to embeded / embedded to linked (extracted) / Re-link linked image / Re-link embedded image. --Gez 19:31, 3 May 2010 (UTC)
If there are several images with broken links and we choose the right path for one of those images (and they share the same location) Inkscape should compare the common location of the broken links and fix the remaining images with the new location automatically.
Example: there are 3 images with broken absolute links:
when the user sets a relative link for the first image to images/cat.png the other images should be automatically relinked, since they had:
- broken links
- the same orignal path
- they exist in the new location.
This operation could be silent, but when there are several images the re-linking process can take some time, so a confirmation window would provide a clear warning about the operation is going to be performed, with the possibility of choosing "yes" to perform the re-link process with the images found, or skipping it choosing "no" This window would appear right after a single re-link.
The confirmation window can optionally show details about the images that are going to be re-linked, with the ability to untick the items that the user doesn't want to automatically re-link.
- Comment: It is possible to uncheck all images and then click "yes", which doesn't make much sense. The text should be worded in a different way. For example, the prompt could be something like "Additional missing images were found. Select the image links you want to fix", choices would be "ok" and "cancel", and the list would always be visible. --Tweenk 19:24, 5 March 2010 (UTC)
Manual selection of relative or absolute paths
Steren pointed me out that there are some situations where selecting manually if the image will be linked using an absolute or a relative path. In that case, the file selector window that opens with the "browse" button of the Image Properties dialog could have radio buttons for selecting absolute or relative. The default value would be proposed by inkscape according the guidelines discussed earlier, but the user would have the ability to force the path to be relative or absolute, according his needs. However, that feature imposes a potential problem: How the smart re-linking feature should act in that case? The automatically re-linked images would use the same path type than the manually selected?
Linked vs. Embedded
The new image properties dialog would have radio buttons for choosing if the image is linked or embedded.
The behavior of those buttons would be the following:
- If the image is linked (default for the imported bitmaps) the behavior would be the described earlier in this blueprint
- if the user chooses "embedded", the url input and its browse button will be grayed out, and the image will be embedded into the SVG document
- if the user chooses "linked" on an image that was previously embedded, a file dialog will be opened, prompting the user to enter a location and a file name (by default the id and the path of the SVG file will be used) to extract and save the image.
- if the link is broken, the "embedded" option will be grayed out until a valid path is set.
- Comment: Embedded / Linked cannot be a radio button, because when we open a file with an embedded image, it has no path assigned. The button should say "extract..." when the image is embedded and bring up a file browser that allows the user to choose the location, and it should say "embed" when the image is linked. There should be a different radio button though: one that allows the user to choose between an absolute and a relative link. --Tweenk 19:29, 5 March 2010 (UTC)
At the moment inkscape doesn't use the imported image's resolution value and use 90 dpi instead. There is a whishlist item in Launchpad about that and it should be fixed in order to implement this feature, otherwise the resolution value wouldn't make sense in this dialog. Notice that resolution value would change the "real world units" size of the image in the document, so changing that value would have impact in the dimensions selectors if they're set to real world units. The original file's resolution is important because it would tell inkscape what dimensions use for the imported image on the document. In my oppinion, if the default document's units are real world units, the resolution value should be used; if pixels are used as default units, the resolution should be disregarded, and grayed out in the dialog.
General Benefits of this change
These enhancements would tackle several usability issues in the current image properties dialog and provide an easy and straightforward solution for broken image links. The image properties would be unified in a single window, adding features that are currently available only via extensions, in locations that may not be so obvious for the new users.
There are a couple of interesting suggestions that can be added to this dialog but I hadn't the time to develop:
- The thumbnail could be used for external editing (double clicking on it, or using a button)
- Add a new option for embedded images: re-link to the original file.