5

Edit a Photo and Create a Hero Image in Inkscape

Inkscape is vector graphics software, but it has limited tools for working with photos too. You can use these to your advantage while creating a trendy and expressive photo-based tech illustration! This project will focus on combining vector elements with photos and teach you about clipping and masking capabilities in Inkscape. These skills will be useful later when you decide to enhance your vector designs with added photos.

In this chapter, we’ll cover the following main topics:

  • When to use photos in Inkscape
  • Preparing the photo
  • Adding a depth of field effect with blur and masking
  • Drawing into the photo
  • Using clipping and masking on the illustration
  • Adding lighting to the image

Technical requirements

Download the photo we will work with during this project. Feel free to use any other photo showing a hand with the palm up.

Here is the image you can get for free and use it in this project: https://github.com/PacktPublishing/Inkscape-by-Example/tree/main/Chapter05.

When to use photos in Inkscape

Inkscape is a vector tool, and it is common knowledge among designers that vector graphics are not meant for photo editing in the classical sense. But there are some valid cases when the elementary photo editing abilities of Inkscape are proven useful, which are as follows:

  • Case 1: When you want to combine actual photos and vector illustrations in your design, you might scale them and rotate them on the spot. Photos can enhance your design and they are useful when creating flyers, posters, or publications – things that you might create in Inkscape. You can simply import bitmap images into Inkscape, and scale, transform, or rotate them almost as freely as vector objects.

There are times when it is easier to scale and transform a bitmap image right there in Inkscape without breaking your workflow. The possibilities are a bit limited, of course – since Inkscape was not made for this. But all the filters you apply and all the masks you create are flexible and easy to change right in Inkscape. You do not have to switch between programs to scale photos, add simple color effects, or apply masks or filters. Even basic retouching can be done on the fly without opening a bitmap photo editor program.

  • Case 2: Tracing! Using a bitmap image to only trace a part of it is why most beginner users open Inkscape for the first time. You can trace by hand using the Bezier tool or use the Trace Bitmap function under the Path menu. Both are useful and a great way to take photos. After tracing, the original photo can be deleted from the file since it is not planned to be part of the final design.

These are the main cases when you will edit photos in Inkscape, and you will practice a bit of both in the main project of this chapter.

In this project, you will create a hero image, as shown in Figure 5.1, a wide banner that can be used as the main header image of a website. You will learn basic photo editing and practice all the tricks you learned while creating the illustration in Chapter 4, Create Detailed Illustrations with Inkscape.

Figure 5.1 – The hero image you will create in this chapter

Figure 5.1 – The hero image you will create in this chapter

Preparing the photo

At the base of this project is a photograph that you will draw a vector illustration on. You can download the photo used in this chapter from the link provided in the Technical requirements section. It is also fine to use another similar photo for this project. If you do so, make sure that the photo you want to use has good resolution and shows someone with an open hand, palm facing up, similar to the original photo.

After you have obtained your image, import it into Inkscape using File | Import, or Ctrl + I.

You can learn more about importing your bitmap images into Inkscape at the beginning of Chapter 2, Design a Clever Tech Logo with Inkscape.

The image we’ll use is quite straightforward, and the main topic is clearly visible against the background. Yet, we should apply some initial changes to it to make the image appear wider and give more space to the illustration we plan to draw on it.

Clipping and masking

Clipping and masking are very similar actions in Inkscape. They are both used to apply a vector mask on another vector shape, group, or even photo (as you will do in the current project). They are similar, but there are some important differences that we need to clarify.

When you are clipping, Inkscape only uses the shape and position of the clipping mask. Color information, opacity, and filters are ignored and do not affect the image in any way. This is why you can create a semi-transparent shape and use it as a clipping mask. It is also very convenient to use any shape with a random color and just create your clip with that.

Masking, on the other hand, works differently, as it also uses the color and opacity of the masking shape! When you apply a mask, Inkscape uses the darkness of the mask shape to set the transparency of the masked object. A white mask with full opacity means zero transparency, while a black mask with 100% opacity causes the final image to be absolutely transparent. Apart from color and opacity, blur is also applied to the masked object.

As you’ll see, there are more variables to consider when applying a mask than using a simple clip. Both methods have their uses, and we will practice both of them in this chapter.

Clipping the photo

After adding focus to the photo, let’s cut the composition of the image tighter. To achieve this, you will use a simple clipping:

  1. Draw a rectangle above the photo and scale it, as shown in Figure 5.2. This shape will be the clipping mask. Set the rectangle to semi-transparent, with an opacity of around 50%. This will help you to see the photo under it, so you can scale and position the clipping rectangle properly.
  2. When the rectangle is positioned, select both the rectangle and the photo. Right-click and choose Set Clip from the drop-down menu. This will clip the photo into the size and shape of the rectangle you placed above it.
Figure 5.2 – Using a rectangle to clip the photo under it

Figure 5.2 – Using a rectangle to clip the photo under it

Your clip is now applied to the photo, and it seems that it is cut to the shape of the clipping rectangle you used. It only seems so because this method preserves the original image! You do not actually erase parts of the image but only hide them.

This means if you are not satisfied with the results, you can right-click on the image and select Release Clip. This will separate the clip from the photo again. No image data is lost; you can refine the clip and apply it again.

Adding the depth of field effect using a mask

Depth of field, or depth of focus, is how sharp or blurry the subject in front of the camera lens appears compared to its surroundings in the photo. It is a great tool that photographers use to bring their subject into focus. Usually, the subject appears sharp, while the background is blurry, which brings the viewers’ attention to the important parts of the image. It is also a widespread digital effect you can recreate using bitmap photo editor programs. Even smartphone photo apps apply an automatic blur filter to create focus in a portrait nowadays.

Using masking, you can create this effect in Inkscape as well! This is not a widespread method in Inkscape, and masking is a bit more complex than clipping but can create more interesting results.

You will draw an illustration over this photo later on, with the main part in the hand of the character. This is where we want to focus the attention of the viewer. The goal is to blur the suit and tie in the background while keeping the hand sharp.

First, you need to remove the clip you added earlier. This happens a lot while using Inkscape, so it is important to practice it. Right-click the clipped photo and select Release Clip. This will make your clip appear over the photo again, and the hidden parts of the photo will be visible again.

Of course, you will need to re-apply this clip later. So, select the clip and send it behind the photo with the End key! This way, it will be positioned in the exact location as before, just hiding under the photo.

Select the photo and apply some blur to it. Do not overdo it; keep the suit recognizable, but blur some details.

Now duplicate the photo with Ctrl + D. Do you remember the sandwich method from Chapter 4, Create Detailed Illustrations with Inkscape? We will do something similar, but with masking this time! The duplicated photo is over the original one, in the same position. Select the duplicate and set the blur back to 0.

Now the blurred image is underneath, with the sharp image over it. Select the Bezier tool and draw a shape over the hand and forearm of the character. The simple background is very forgiving; as you can see in Figure 5.3, you do not have to trace the hand perfectly!

Figure 5.3 – How to draw the mask over the photo

Figure 5.3 – How to draw the mask over the photo

This shape will be the mask you will apply to the sharp photo. To get that right, set the fill color of the shape to white with full opacity, then add a horizontal gradient to it, as shown in Figure 5.3. The white part of the mask will be visible, and the transparent part of the mask will be applied with the same opacity as the mask.

Select the sharp photo and the shape over it, right-click on them, then select Set Mask from the pop-up menu. If you set the gradient correctly, the sharp hand and forearm will smoothly fade into the blurred arm and background. The same applies to masking as to clipping: if you are not satisfied, right-click the masked photo, select Release Mask, and try again! The image information is still there, and nothing has been deleted.

Finally, select the hand part and the blurred photo, and group them with Ctrl + G.

Figure 5.4 – The masked sharp photo over the blurred original

Figure 5.4 – The masked sharp photo over the blurred original

Now the photo looks more interesting, and the focus effect works well, but the edge of the photo is also blurred. But there is an easy solution: remember the clip you created earlier? That rectangle is still under the photo!

Select the group of photos and send it to the back with the End key. This will make the clipping rectangle appear on top again.

Clips and masks can be applied to photos and shapes and groups as well. Select the group of the photos and the rectangle and apply the clipping rectangle to the group by right-clicking and selecting Set Clip. This will seemingly trim the photo back to the shape and size it was before.

Figure 5.5 – The clipped group containing the blurred and the masked photos

Figure 5.5 – The clipped group containing the blurred and the masked photos

The masked hand and the blur will be intact, and the focus effect will not disappear. You can use multiple masks and clips in Inkscape using groups.

Tip

Blurring and working with photos in Inkscape can be taxing on your computer’s memory. If you notice any lag, switch to No Filters in the Display Mode section of the View menu. The effect will be intact, but Inkscape will not render it, freeing up memory.

Making the background of the photo wider

Now that the photo is clipped and better focused on the subject, you need to create some blank space. We need this space to provide a smooth background for your illustration. Since the character is turning left, and its hand is gesturing in that direction too, this is where you want to create more space.

If you just click on the photo and resize it, it will stretch, and this is not what you need. To create space, you need to seamlessly expand the background of the photo. You will not actually widen the photo but add a shape to the left to make the image appear wider.

This method also provides a clean enough background for any text you need to place on the image later. The text needs to be read, and a blank and homogenous background adds contrast and helps legibility.

First, draw a rectangle the same height as your clipped photo.

Position this rectangle over the left side of the photo, with some overlap. You will need this overlapping to create a smooth covering. Don’t be afraid of covering up some of the hands as well, as shown in Figure 5.6.

Figure 5.6 – Position the rectangle on the left with some overlap

Figure 5.6 – Position the rectangle on the left with some overlap

After positioning the rectangle, apply a dark blue color to it using the Color picker tool. Hold the mouse button and use the local color mixing method we learned about in Chapter 4, Creating a Detailed Illustration in Inkscape. This works great on bitmap images because it will get the average color of the selected pixels of the photo.

After coloring the rectangle, use the Gradient tool and apply a linear gradient to it. The left side of the gradient should have full alpha, while the right should be transparent. Position the gradient handlers, as shown in Figure 5.7. The trick is to cover the edge of the photo: make sure that both gradient handlers are over the photo so the transparent parts of the gradient overlap the photo!

Figure 5.7 – How to apply the gradient to cover the edge of the photo

Figure 5.7 – How to apply the gradient to cover the edge of the photo

After fine-tuning the gradient of the rectangle over your photo, select the covering rectangle and the photo group and group them with Ctrl + G.

Tip

Covering using shapes with gradients is a handy trick I use a lot to create space on one side of photos in Inkscape as you just did here. It can be a smooth place for text or cover up unwanted parts of the image. And, of course, the same trick works for covering up a sky with light blue colors or adding a smooth background to a busy image. This simple method offers a lot of possibilities.

Using a gradient cover, the photo now appears wider. This has created enough extra space for your illustration and any text you would like to add later when you use this hero image. You have also created focus by adding a blurred version of the photo and using a mask. The photo now looks ready, and the next step is to create the vector illustration you will combine with it.

Drawing into the photo

In this project, we will be drawing into the photo instead of drawing onto the photo. It means we will use clipping and masking to make the illustration appear as part of the photo. We will fit the vector drawing into the natural space of the image. You will learn some useful tricks about this method later in this project, but first, you need to create an illustration to use it!

Preparing a simple illustration

A good designer is resourceful – in this case, this means reusing elements you have already created in previous chapters of the book. These are all simple shapes, but it is much easier to copy and paste them than to draw them from scratch. You will need a cloud, a human icon, and a lock icon, as shown in Figure 5.8.

Figure 5.8 – Reuse the cloud, human, and lock elements to form a new illustration

Figure 5.8 – Reuse the cloud, human, and lock elements to form a new illustration

First, you will need the cloud you created back in Chapter 3, Modular Icon Set Design with the Power of Vector. Copy the cloud shape from there into the active work document with the photo. This cloud will serve as the center of the illustration.

Second, copy the human shape we designed back in Chapter 2, Design a Clever Tech Logo with Inkscape. This little user icon will be at the nodes of the network of the illustration.

And third, to make things a bit more interesting, copy the lock icon from Chapter 3, Modular Icon Set Design with the Power of Vector.

If you skipped the previous chapters or did not design those elements yet, look for the description of those pieces in the mentioned chapters and create them now!

Changing the lock icon

If you copied all three elements into the file, you will see that their style is different. The cloud and the human icons are flat, colored shapes, while the lock is an outline icon. Set the first two aside for now and focus on the lock. That needs to be turned into a flat version too.

To achieve this, first, select the body of the lock and give it a fill color. It can be any color; for now, I have used blue.

Most of the lock icons are built from outline strokes. Select all the parts of the lock and turn all the strokes to paths with Stroke to Path in the Path menu by pressing Ctrl + Alt + C. This will make the shapes easy to color and merge together later.

We need to cut the keyhole in the middle of the lock. Select the circle and the vertical part of the keyhole and merge them into one shape with Path | Union.

Then select this new keyhole shape and the body of the lock, using Path | Difference (by pressing Ctrl + -), and cut the keyhole into the lock shape.

Now select all the parts of the lock and, using Path | Union (by pressing Ctrl + +), merge them into one single shape.

Figure 5.9 – The steps to turn the lock icon into a flat-style icon

Figure 5.9 – The steps to turn the lock icon into a flat-style icon

These might seem like extra steps, but changing an existing design, however simple it may be, is usually easier than drawing an icon from zero.

Creating the network illustration

Now you have to create the network illustration over the photo. The illustration is built up of two main parts – the nodes of the network and the lines connecting the nodes. It is smarter to start the network with a layout of the node elements. If you create this layout first, it will be easier to connect the nodes.

Take the cloud shape and position it over the hand in the photo. The main part of the illustration will be the hand holding the cloud. This is why the cloud has to be in the center of the illustration too.

Now position the user icon on the photo, not far from the cloud. Duplicate this icon multiple times and spread these other users around too.

Repeat the same positioning and duplicate the lock icon too! This will make the network more interesting than just a simple grid of nodes. Do not overdo it; find the balance and just use a few copies of these icons!

Finally, draw a small circle, the size a bit bigger than the head of the user icon. Duplicate this circle over the photo to create 8-10 extra nodes for your network. Take a look at Figure 5.10 to see how to spread out the network nodes.

Select all the nodes, locks, user icons, and the cloud and color them the same light blue.

Figure 5.10 – The cloud and duplicated nodes spread out over the photo

Figure 5.10 – The cloud and duplicated nodes spread out over the photo

When every node is in position, you only have to connect them to create a network. Using the Bezier tool, connect the nodes to the cloud and to each other with straight lines. Use the same light blue color for these lines you used for the nodes, and keep them thin and straight.

Leave the end of the network open, and have some lines leading outwards. These loose ends will hint at a bigger network. You do not have to run the lines precisely till the edge of the photo; you will fix that later. For now, just be playful here; take this as a simple puzzle. There is no rule about how many lines can connect to one node; just take care that wherever the lines cross, there has to be a node.

When you are satisfied with the network you have drawn, select all the lines and nodes and group them with Ctrl + G. Leave the cloud out of this group; you will work with that soon.

Figure 5.11 – The network of lines connecting the nodes

Figure 5.11 – The network of lines connecting the nodes

It is time to hide those loose ends. As you can see now, they seem to be cut abruptly. You can change that by applying a simple mask to the group containing the network.

Draw a white ellipse covering the network illustration; this will be your mask. If you just apply it to the network now, it will hide all the parts of the group outside of the ellipse but still will create sharp ends. You have already learned about using gradients on masking shapes to create a smooth fading effect.

But this time, add some blur to the ellipse. Inkscape also calculates the masking area using blurred masking shapes. In this case, it is also faster and gives you more control over the area you would like to show.

Figure 5.12 – The position and amount of blur of the masking ellipse over the group

Figure 5.12 – The position and amount of blur of the masking ellipse over the group

Position, scale, and blur the ellipse, as shown in Figure 5.12. When you are satisfied with the area covered, select the ellipse and the network group under it, and right-click to select Set Mask from the menu. This will apply the mask to the group, and because of the blur, the lines on the edges will smoothly fade away.

Again, as with clips and masks before, if you are not satisfied with the result, right-click and select Release Mask from the pop-up menu after right-clicking the group. This way, you can modify the mask, change the amount of the blur effect, then set the blurred ellipse as a mask again.

Figure 5.13 – The network group with the mask applied

Figure 5.13 – The network group with the mask applied

The network and all of its elements are in place, and with the mask applied, they all blend into the image smoothly.

Clipping the cloud

The only thing that seems out of the picture now is the cloud. You have to work on that to create the illusion that the cloud is somehow part of the photo. Instead of editing the photo itself, you will edit this vector element to look like it is in the photo!

To achieve this, you will clip the cloud to make it look like it is behind the fingers and partly covered by them. Move the cloud aside for now and focus on the fingers in the photo. To create the clipping shape for the cloud, first, you have to trace the shape of the fingers holding the cloud.

First, trace the fingers using the Bezier tool. Start rough with straight lines, then refine the curves with the Path editor tool. Use a color that is easy to differentiate from the background – I have used bright green against the orange skin tones of the hand. Set the opacity of the shape to 40-50% to see what the elements under the shape will cover.

Draw the shape of the fingers in the front since these will be in front of the cloud, and ignore the thumb. That will be behind the cloud, so it does not have to be part of the tracing. You can also keep the bottom part flat, as that will not be part of the clip either.

Figure 5.14 – Drawing the clipping shape tracing the fingers

Figure 5.14 – Drawing the clipping shape tracing the fingers

When you finish the final shape for the fingers, put the cloud shape back into its place. But do not apply the clipping shape yet!

Why? Because this is not the final shape. If you set this shape now as a clip, it will only reveal what is under it! This would create the opposite of your goal and show the cloud only where there are fingers.

To avoid this, draw a rectangle covering the cloud. Then, send it behind the shape you drew earlier (using the Page Down key), and selecting both, use Path Difference to cut the shape of the fingers out of the rectangle. For a better understanding, see Figure 5.15.

Figure 5.15 – How to create the clip from a square

Figure 5.15 – How to create the clip from a square

After you cut the finger shapes out of the rectangle, you have your clipping shape ready. Now you are able to apply this to the cloud so the parts that are supposed to be hidden by the fingers will be hidden.

I explained earlier that clipping the cloud is better than cutting it because this method preserves the original shape and makes editing easier. But clips (and masks) can be applied to groups as well! The advantage of this is that you can move elements inside a clipped group.

In this case, the position of the cloud on the photo is flexible, but the position of the fingers on the photo is given. You cannot change the position of the fingers, but it is beneficial that you can move the cloud behind the fingers to decide where it looks the best.

So even if the cloud is one object only, select it and hit Ctrl + G to create a group out of it. This is a group now holding one object; the shape you will use for clipping has to be outside this group.

Select the cloud group and the clipping mask over it and choose Set Clip from the right-click menu. This will set the clip on the group, and parts of the cloud will disappear (seemingly) behind the fingers.

And here comes the trick: if you want to modify the position, color, or shape of the cloud, just double-click on the clipped group to get inside it. Now you can select the cloud shape and modify its properties.

While you are inside the group, select the cloud, and add a gradient to it. Keep the bottom part light blue and set the top to a darker blue. This will make it look like light is coming from under the cloud. We will add some more lighting later to work with this.

Figure 5.16 – The clipped cloud looks like it is behind the fingers

Figure 5.16 – The clipped cloud looks like it is behind the fingers

If you are not satisfied with the clip itself, though, you can select Release Clip to modify the shape of the clipping object, then re-apply it by selecting Set Clip.

Tip: clipping on groups

Setting a clip or a mask to a group of objects can be really useful! It is great for drawing the eyes of characters, for example, since you can come back anytime and easily change where the eye is looking. Or you can set a clip to a group of objects that you want to show on a mobile screen, modify the elements, and try out different arrangements. This has endless applications, really; practice and use it to make your life easier!

The way we apply clips to groups is not the same as the Clipping Group option in the right-click menu! That is an automated function, and it duplicates the selected object and sets this copy of itself as a clip. It is almost the same, but you have less control over the outcome as the shape of the clip is given.

The clipping of the cloud makes it look like it is part of the photo. To complete the illusion, we will add lights to the cloud and network.

Adding lighting to the image

There are two ways you will add lighting to this illustration to make it more interesting. First, you will create the light that is under the cloud. Second, you will add a simple glow effect to the network.

Adding a glow under the cloud

The first method is about creating a shape that will act as the light on the palm of the hand. Since the palm of the hand is lit, this is easy to achieve:

  1. Select the Bezier tool and trace the bright parts of the palm. Use the same method as earlier when tracing the fingers to clip the cloud shape: start with simple straight lines and refine the shape using the Path editor tool. As you can see in Figure 5.17, I have created more than one shape to cover all the bright parts on the palm and between the fingers.
  2. Select these shapes and combine them with Union from the Path menu. Do not forget to send the light shape behind the cloud with Page Down!
  3. Set the fill color of this shape to bright blue and its opacity to 40-50%.
  4. Add a horizontal gradient to it, so it softly fades out to the right, around the wrist.
  5. Finally, add a small amount of blur to the shape to create an even softer effect. See my version in Figure 5.17.
Figure 5.17 – Drawing the lit parts under the cloud and adding gradient and blur

Figure 5.17 – Drawing the lit parts under the cloud and adding gradient and blur

This shine under the cloud seems like a minor change, but this small modification elevates the whole illustration.

Creating the glow around the network

To give even more light to the illustration, let’s add a light glow to the network itself. This will not only highlight the lines of the network but give it a digital hologram feeling. We will use a simple method to add the glow around the network:

  1. Double-click the network illustration to get inside the masked group.
  2. Select all the elements of the network with Ctrl + A. If you are inside a group, Ctrl + A (meaning select all) only selects the element inside of the given group. So, if you are now working inside the masked group, only the objects and lines building up the network will be selected, and nothing outside the group.
  3. Group these selected elements again with Ctrl + G. This will create a group inside the masked group.
  4. Duplicate this group with Ctrl + D. Now you have the network illustration inside the masked group twice.
  5. Select the duplicate, and without moving it, apply a small amount of blur to it! This will create the glow effect, as seen in Figure 5.18!
Figure 5.18 – The glow around the network illustration

Figure 5.18 – The glow around the network illustration

Why do you have to click inside the group first to achieve this? The reason is to spare time and resources. You could simply duplicate the masked group but doing so would create a hard-to-render illustration for Inkscape.

Apart from using fewer resources, it is also easier to work with a simple masked group containing the network elements. With a few clicks, you can easily modify the elements again if you need, including the masking shape.

Saving and exporting

Now that the image is ready, it is time to save it in the correct format.

If this is to be an illustration only, you might use the image as a .svg file on a website. And of course, it is clever to save it as .svg for later editing and to easily copy it into other .svg files. Save the file as .svg to preserve the vector elements.

But if you want to use it straight away, it is better to export it as a bitmap image for the following two reasons:

  • The effects we used: The added blur effect, masks, and clips may not appear the same way on every platform. Besides, older browsers and computers with fewer resources might struggle with the memory load.
  • The base of the design is a photo: Using the image as a vector file will only work if the image is embedded into the file or the linked image has a clear path and the .svg file can always find it (without this, the photo would not load in the design).

So, if you aim to present your design as it was intended – and of course you do – then export it into a bitmap format. This way it will keep all the effects while sparing memory and loading times. You might choose .png, .jpg, or the new .webp format for online usage.

Summary

The aim of this chapter was to highlight the photo editing capabilities of Inkscape. You started this project by learning more about clipping and masking and clipping the photo to focus on the main subject. Then you added the depth of focus effect, using blur and masking. Then you modified the image via an added blank space that seemingly widened the photo.

During this project, you drew an illustration over the photo. You used the previously created elements and repurposed them. Furthermore, you built the illustration into the photo with the clever use of masking and clipping.

Finally, you added lighting and glow to the image to create a modern atmosphere suitable for a tech company. In the next chapter, you will learn how to use Inkscape to create a responsive website template.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset