Outils pour utilisateurs

Outils du site


issue203:inkscape

Ceci est une ancienne révision du document !


This month, I’ll be looking at another dialog that was updated with Inkscape 1.3: the Object Attributes dialog. This is one that I haven’t covered in this series before, because, quite frankly, I had no idea it even existed! That came as quite a surprise to me – after more than a decade of writing Inkscape tutorials, I thought I’d found just about every hidden corner of the application, but it turns out I was wrong. The content of this dialog changes based on the selected object. If a bitmap image is selected, then this dialog replaces the older ‘Image Properties…’ dialog that was available via the right-click context menu. In fact it replaces it to the extent that it still appears in the context menu with the same label, but the dialog that opens is definitely now ‘Object Attributes’. At the top of the dialog is a thumbnail of the image, together with its dimensions and a label to indicate whether it’s linked or embedded. In the latter case, the label also shows the amount of space the image data takes up, to give you an idea of how much it will bloat your SVG file size. The text beneath the thumbnail shows the image’s ID, prefixed by a hash character. This is a little misleading, as the default for showing the ID in the Object Properties dialog is to not include a hash, whereas the placeholder text for the ‘Label’ field does include it.

Even if you set a label via this field in the Object Properties dialog, it is not displayed in the Object Attributes dialog. I guess the Inkscape developers must have their own idea of what’s a property and what’s an attribute, and only the ID counts as the latter. Moving on down the dialog, the URL field shows the path to the linked image. For an embedded image, this field is disabled. Although the field is editable for a linked image, changes made here are not reflected in the stored data for the image in the SVG file. If, as I do, you keep your linked bitmaps in the same folder as their SVG file, you can sometimes find that moving or copying SVGs results in them being linked to the wrong place, via an absolute path. In older versions it was possible to directly edit the link via this dialog, replacing the absolute path with a local filename. Not any more. Instead you have to use the button to the right of the URL field which allows you to select a different image to replace the linked or embedded one. Even using this to select a file in the same directory as the SVG results in an absolute ‘file://…’ URL rather than a simple filename. This is definitely something to be aware of, as it not only results in less transportable files (ie. just sending someone the directory containing both the SVG and the bitmaps probably won’t work), but also leaks information about the folder structure on your machine, which might be considered a security risk, albeit a relatively minor one. On reloading your SVG file you may find that Inkscape does replace the URL with a simple filename if they’re in the same directory, but I was unable to find any reliable, repeatable steps that would consistently make this happen across the files I tested with. The only way to really be sure is to edit any linked image paths directly in the XML editor.** The buttons below the URL field allow you to convert a linked image to an embedded one, or to export a copy of the image – regardless of whether it’s linked or embedded – to a new location. One use of this might be to save a copy of an embedded file, then use the folder icon next to the URL to replace the embedded file with a link to the external copy you just saved. A button to achieve this with a single click would be nice, though – making it just as easy to un-embed an image as it is to embed one.

A welcome addition is the pair of radio buttons to select between preserving the aspect ratio of the image, or stretching it out of proportion if necessary. I’d like to see buttons to revert to the original dimensions, or to keep the width or height fixed while changing the other dimension to suit the original proportions. Being able to preserve the aspect ratio allows you to address most of the issues for which such buttons would be of benefit, though, turning these tasks from ‘almost impossible’ to just ‘a bit tricky’. Finally, a popup lets you select between different rendering hints. This is the same as the ‘Image Rendering’ popup you can see in the Object Properties dialog. Note that selecting any of the options in this menu really is just a hint; whether or not they’re honored will depend on the software being used to display or print the SVG.

But what if you want to view the Object Attributes dialog for something other than an image? Common sense would say that you just right-click on the object and select it from the context menu? Or choose it from the main ‘Object’ menu, right? Common sense, it would seem, is a little short among the Inkscape UX team in this case, as neither of these menus contain an entry for this dialog. One way to get to it is to use the Image Properties menu option on a raster image, then select the object you’re actually interested in. The dialog will change dynamically as objects are selected, so will update to reflect the non-image item you’ve chosen. But that’s hardly an effective way to get to this dialog, and your drawing might not even contain any bitmaps that you can right-click on.

Instead, the official way to open this dialog is to either bind it to a keyboard shortcut via Preferences dialog (in the Interface > Keyboard pane), or access it via the ‘dialog popup menu’. The what now? If you’ve no idea what I’m talking about, you’re not alone – I also had to go hunting to find this menu, as it wasn’t a term I was familiar with.

When you open a dialog – any dialog – within Inkscape, there is an icon at the right of the tab bar (circled top right). This is present whether the dialog is opened in a window, or docked to Inkscape’s main window. With the theme I use, this icon appears as a light grey down-facing arrow which is very easy to miss. Here it is at the top-right of the Fill & Stroke dialog on my machine, circled in red because it really is so easy to miss. Clicking this icon opens the ‘dialog popup menu’ (right).

In my defence, I was vaguely aware of this menu, but it’s not one I ever use. The top few entries are useful if you’re managing multiple dialogs in a tabbed interface which is probably docked to the main window. That’s not the way I work. The remaining entries open various dialogs, but I always open my dialogs via toolbar buttons, menus, and context menus. Never by clicking on a faint icon in some completely different dialog, then selecting the thing I really wanted via this menu.

Towards the bottom of the dialog, in the ‘Settings’ section, you can find the entry for Object Attributes. If you don’t have a bitmap image in your document, and haven’t bound a separate keyboard shortcut, this seems to be the only way to access it. To summarise, the steps required are: • Open a dialog. Any one will do, so feel free to use the “Layers and Objects”, “Fill and Stroke”, or “Align and Distribute” dialogs if they’re already open. If you don’t have a dialog open, right-clicking on an object and choosing “Document Properties” feels to me like a route that won’t break the mental context of what you’re trying to do. • Click on the icon at the right of the tab bar in your selected dialog.

• Click on “Object Attributes” in the Settings section of the menu. • On the canvas, select the object whose attributes you wish to view or edit. • Optionally close the other dialog if you no longer require it. With nothing selected, the dialog is empty, and with multiple objects selected, it simply shows the text “Multiple objects selected”. When an individual object is selected, however, the display will change depending on the type of object. We’ve already seen how it looks when a bitmap image is chosen, but here are the other possibilities:

Essentially these replicate the controls in the relevant tool control bar for each type of object, but there are some interesting additions and differences. First is that the object’s fill and stroke colors, and stroke width, are indicated at the top-right of each view. None of the other stroke properties are reflected here, and unlike the corresponding swatches and numbers in the status bar, you can’t change the values in any way from here. Disappointingly, clicking on the swatches doesn’t even open the Fill & Stroke dialog.

The top row of fields for Rectangles and Ellipses has a small icon to the right. Clicking this will round the values in those fields to the nearest integer, which is a potentially handy feature that would be nice to have in the main tool control bar fields. Conversely, the quick shortcut values that are present on the context menus for these fields in the tool control bar are not included within this dialog. That limitation applies to all the fields, regardless of the selected object. The Rectangle pane has a couple of buttons at the bottom. The first sets the corner radius values to zero (i.e. 90° corners) as it does in the tool control bar. But the second button is another useful one which is missing from the tool control bar: it adds the ‘Corners’ live path effect, allowing each of the four corner radii to be modified independently. The Object Attributes dialog does not actually show the individual values, however – this button is more of a quick way to add the LPE so you can tweak the values on-canvas, but you’ll still need to open the LPE dialog for fine control and editing.

The Star pane also has a couple of extra touches compared to the regular tool control bar. The first is the third button in the ‘Shape’ row – whose drab icon in this theme makes it appear disabled, even though it isn’t. The tooltip in this button says ‘Level shape’, which in this case means that it will be rotated such that the first spoke runs vertically. Inkscape veterans already know to hold the CTRL key and drag upwards when using the Star tool to achieve this type of alignment, but if you’re not aware of that trick, or you simply forget to do it on a particular object, reorienting a star or regular polygon to make it neatly aligned can be a surprisingly tricky task. This button achieves it with one click, and makes me wonder why this isn’t also on the tool control bar. The other feature is less impressive, but a nice touch nevertheless: next to the last three numeric entry fields is a small ‘×’ button which appears when these fields are set to anything other than their default values (0.5, 0 and 0, respectively). Clicking the button simply resets that field back to its default.

Missing in this image are the Object Attributes panes for Spirals, Paths, Text, and 3D Boxes. None of these objects show any content at all in this dialog – not even the non-editable fill and stroke information. This makes the dialog as a whole feel rather unfinished and inconsistent. Perhaps that’s why it’s been hidden away so well.

In summary, this dialog is a potentially useful tool which even offers a few capabilities that can’t be found anywhere else in Inkscape. That makes it all the more disappointing that it’s hidden away in an obscure popup menu, rather than appearing in the context menu. This is doubly baffling when you consider that it does appear there – albeit with a historic title – if the selected object happens to be a bitmap image. I’m not sure I’ll use this dialog enough to warrant creating a keybinding for it, but now that I know it exists I’ve little doubt that I’ll have cause to open it from time to time. To be honest, that will mostly be when I forgot to hold CTRL while creating a star.**

issue203/inkscape.1712037879.txt.gz · Dernière modification : 2024/04/02 08:04 de d52fr