Outils pour utilisateurs

Outils du site


issue75:inkscape

Ceci est une ancienne révision du document !


Although Inkscape is a vector graphics program, it does have some support for including bitmap images in your drawings. It's certainly not a fully fledged bitmap editor, and neither is it a desktop publishing program. If you want to airbrush a photo, you would be better off using The GIMP, and if you want to lay out a newsletter, then Scribus would be a better tool.

Bien que Inkscape soit un logiciel de graphisme vectoriel, il a les capacités pour incorporer des images bitmap dans vos dessins. Ce n'est certainement pas un éditeur bitmap à part entière, et n'est pas non plus un programme de PAO. Si vous voulez traiter à l'aérographe une photo, vous feriez mieux d'utiliser The GIMP, et si vous souhaitez disposer d'un bulletin, Scribus serait alors un meilleur outil.

Getting an image into Inkscape is quite simple. My preference is to drag-and-drop it from the desktop or file manager into the main Inkscape window. Alternatively, you can use File > Import to pull your picture into an open document. File > Open will also do the job, but that will create a new Inkscape document with just the image in, and the document's page size set to the dimensions of the image. Whichever approach you take, you will next be presented with an import dialog (left)).

Intégrer une image dans Inkscape est assez simple. Ma préférence va au glisser-déposer depuis le bureau ou le gestionnaire de fichier vers la fenêtre principale d'Inkscape. Alternativement, vous pouvez utiliser Fichier > Importer pour insérer votre image dans un document ouvert. Fichier > Ouvrir saura aussi faire le travail, mais permettra de créer un nouveau document Inkscape avec juste l'image, et la taille de page du document mise aux dimensions de l'image. Quelle que soit l'approche que vous choisissez, vous serez ensuite confronté à une boîte de dialogue d'importation (à gauche)[NdT : Nommée dans la version actuelle : Entrée bmp GDK pixbuf.].

If you select “Embed” then the image will be included as part of the Inkscape file. For the technically minded it is Base64 encoded, which is a means of representing binary data using text. Unfortunately, this encoding has been designed for robustness rather than efficiency, so will inflate the storage space required for your bitmap by about a third. The advantage, however, is that an embedded image is part of the SVG file, so if you move the document to another location, or even another machine, the bitmap will move with it.

Si vous sélectionnez “incorporer” alors l'image sera incluse dans le fichier Inkscape. Pour ceux que la technique intéresse, elle est encodé en Base64, qui est un moyen de représenter les données binaires en utilisant le texte. Malheureusement, ce codage a été conçu pour la robustesse plutôt que l'efficacité, il en résultera un gonflement de l'espace de stockage nécessaire pour votre bitmap d'environ un tiers. L'avantage, cependant, est que l'image intégrée fait partie du fichier SVG, si vous déplacez le document vers un autre emplacement, ou même une autre machine, l'image bitmap sera déplacée avec lui.

Selecting “Link” will include the location of your bitmap in the SVG file, but not the data that makes up the image itself. If you subsequently move the SVG file, you'll need to move the bitmap with it, or fix the link to account for the change in location. One advantage of linking a file is that, if you make changes to the original bitmap image, those changes will be automatically reflected in the Inkscape document. For an embedded bitmap you would have to remove the current version from the document and then embed the modified version.

Sélectionner “lier” pour indiquer l'emplacement de votre image bitmap dans le fichier SVG, mais pas les données qui composent l'image. Si vous déplacez ensuite le fichier SVG, vous devez déplacer le bitmap avec lui, ou corriger le lien pour prendre en compte le changement d'emplacement. Un avantage de lier un fichier, c'est que, si vous apportez des modifications à l'image bitmap d'origine, ces modifications seront automatiquement répercutées dans le document Inkscape. Pour un bitmap incorporé vous auriez à supprimer la version actuelle du document, puis incorporer la version modifiée de l'image.

Which option to choose depends on what you are doing with the bitmap in your Inkscape drawing. If it's only there temporarily—so that you can trace over it, or use it for reference—then linking is probably the best option. For use as a permanent part of your design, then embedding might be better – especially if you plan to move the Inkscape file, put it on a web server, or send it to someone else. If you're unsure, then I would suggest linking the image; you can always embed it later using the Extensions > Images > Embed Images… menu option.

Le choix de l'option dépend de ce que vous faites avec le bitmap dans votre dessin Inkscape. S'il n'est utilisé que temporairement, de sorte que vous pouvez le décalquer, ou l'utiliser comme référence, alors le lier est probablement la meilleure option. Pour une utilisation en tant que partie intégrante de votre conception, alors l'incorporer est sans doute mieux - en particulier si vous envisagez de déplacer le fichier Inkscape, le mettre sur un serveur web, ou l'envoyer à quelqu'un d'autre. Si vous n'êtes pas sûr, alors je suggère de lier l'image, vous pouvez toujours l'incorporer plus tard en utilisant les options du menu Extensions > Images > Incorporer les images…

Checking the “Don't ask again” box will mean that future imports will default to your choice of Embed or Link. I prefer to leave this unchecked, as I tend to switch between the two options depending on what I'm drawing. If you do check this and then subsequently change your mind you can switch to the other option, or tell Inkscape to ask in future, via File > Inkscape Preferences… then selecting the Bitmap section and changing the “Bitmap import” option.

Cocher la case “Ne plus demander” signifie que les importations futures seront par défaut votre choix incorporer ou lier. Je préfère laisser cette case non cochée, comme j'ai tendance à basculer entre les deux options en fonction de ce que je dessine. Si vous la cochez et ensuite changez d'avis, vous pouvez passer à l'autre option, ou dire Inkscape de la poser de nouveau à l'avenir, via Fichier > Préférences d'Inkscape … puis en sélectionnant la section Bitmaps et changer l'option “Bitmap importation”. [NdT : Cela ne semble plus exister dan la version 0.48.]

Having imported an image, it will appear in Inkscape with the normal selection handles. One thing that might surprise you is the size of the image—imported bitmaps tend to be bigger than you might expect. This is because Inkscape imports them at a resolution of 90dpi, regardless of the size, shape or embedded metadata of the image. At this resolution, a 900 pixel tall image will be 10 inches tall, nearly filling an A4 page.

Après avoir importé une image, elle apparaîtra dans Inkscape avec les poignées de sélection normales. Une chose qui pourrait vous surprendre, c'est que la taille des images bitmaps importées a tendance à être plus grande que vous ne le pensez. C'est parce que Inkscape les importe à une résolution de 90 dpi, quelle que soit la taille, la forme ou les métadonnées intégrées de l'image. À cette résolution, une image de 900 pixels de haut sera haute de 10 pouces, et remplira pratiquement une page A4.

Within Inkscape, it might be useful to think of your picture as being a group of colored squares—albeit a group that you can't enter or un-group. Each square is drawn at 1/90 of an inch in size, but you can scale it up or down using the selection handles, just as you would with any other object. Scaling like this doesn't change the number of rectangles in the group, it just changes the size and shape of each one. You can also skew and rotate the image, or change its opacity, just as you would with any other group of rectangles. Here's an example of an image made up of only 25 pixels, but copied, scaled and transformed to fill an A4 page. You can see that talking in terms of pixels and dpi quickly stops making sense when you've transformed your pixels into rotated rhomboids! Sometimes, you don't want the whole of a bitmap image in your drawing. If your image is a PNG file, then Inkscape will honor any transparency that's present. This can be used to include non-rectangular elements into your drawing. Take the Full Circle Magazine logo as an example: you can clearly see the difference between using importing a JPEG version, which doesn't support transparency, compared with a PNG version, which does.

When protecting sensitive readers from the fleshy expanses of renaissance art, for example, a pair of PNGs makes for a reasonable brassiere, whereas JPEGs lead to overly obtrusive underpants…

Another way to show just a sub-section of an image is to use clipping. This works in exactly the same way as clipping any other object—just draw a clip path on top, select both the path and the image, and then choose Set Clip from the context menu, or Object > Clip > Set from the main menu. Using this with the bottom left corner of our renaissance painting, followed by some rotating and flipping, leads to an image that should be familiar to anyone who has seen Monty Python's Flying Circus.

The hard edges of a clipped image don't suit every requirement, but, as you might expect, masking also works. A simple blurred shape with a white fill, used as a mask, lets you feather the edges of a bitmap image for a softer effect.

As you may recall from the previous part of this tutorial, masks are just collections of colored pixels—just like bitmap images. Inkscape will happily let you use an imported bitmap as a mask—it's really no different to using a group of rectangles. On first impressions it looks as though using an image as a mask results in something like a photographic negative: What you're actually seeing is the white of the Inkscape canvas showing through the darker parts of the image, and the color of the masked object appearing where there are lighter parts in the image. By changing the masked object to a lighter color, and using a dark object as the background, relative normality is restored:

It's worth noting that you can mask any sort of object. The examples here all use an image to mask a single rectangle with a flat fill color, but you can use the same technique on an object with a gradient or pattern fill, or even on a group of objects.

Depending on your source image, you may find that you get better results if you convert it to a grayscale using a bitmap editor such as The GIMP. A bitmap editor will also give you the opportunity to lighten, or darken, or even invert, the colors of the image. If the image was included in Inkscape as a Link rather than an Embed, the effect of your changes will be applied to your Inkscape drawing each time you save the bitmap image in your editor, allowing you to easily experiment with different changes to the bitmap. In my experience Inkscape isn't always perfect at refreshing the screen when the bitmap changes, but scrolling the canvas a little, or changing the zoom level, usually fixes the issue.

Using bitmaps as masks can be another way to get around the limited types of gradients that the SVG format supports. For example, by creating a conical gradient in The GIMP, then using it to mask a yellow square on a green background, it's possible to produce a conical yellow-green gradient that would be difficult to create in Inkscape alone.

Of course this approach doesn't result in a genuine vector gradient, so the accuracy is determined by the resolution of your bitmap. You could get the same effect by simply creating a yellow-green conical gradient directly in The GIMP, and then importing it directly into Inkscape. By using the image as a mask, however, you can still freely change the colors within Inkscape, rather than having to modify the bitmap image each time.

A major limitation of this method is that you can affect the transparency of only one object at a time, so gradients with multiple color stops are a problem. You can work around this by using your mask on a group of objects, or by layering several masked objects on top of each other, but that can quickly become complex. To demonstrate this approach, I've created a bitmap using the “Three Bars sin” gradient from The GIMP, drawn as a spiral gradient. I first applied this to the same yellow square on a green background as used previously, then duplicated it in-place (Edit > Duplicate, or Ctrl-D) before rotating it slightly to give a multi-colored spiral gradient.

As you can see, once a bitmap has been linked or embedded into an Inkscape document, you can pretty much treat it in the same manner as any other object. If you think of it simply as a group of colored rectangles then you won't go far wrong. Don't mistake Inkscape for a bitmap editor or a desktop publishing program, though—The GIMP or Scribus are far better tools for those tasks.

Next time, we'll continue our tour of bitmaps in Inkscape by finding out how to turn them into genuine vectors.

Image Credits

“Venus, Cupid, Folly and Time” by Angelo Bronzino http://commons.wikimedia.org/wiki/File:Angelo_Bronzino_001.jpg

“La Gioconda” (aka “Mona Lisa”) by Leonardo da Vinci http://en.wikipedia.org/wiki/File:Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg

issue75/inkscape.1387347925.txt.gz · Dernière modification : 2013/12/18 07:25 de fcm_-_ekel