Skip to main content

Inkscape: Make your own flag-overlaid profile pic

[Note: This was first published as a Facebook Note on July 7, 2015. I am making it available here to add to the Inkscape tutorials.]
Tired of waiting for Facebook to put out an app where you can overlay a country flag’s colors on your profile pic to show your sympathy? Why not make your own? Inkscape easily allows you to do that. But that means you’ll need to spend some time learning how to use a vector graphics program, if you don’t know how to yet. Inkscape is a simple-looking vector graphics program and it only outputs to PNG, but you can carry it as a portable app on a USB pen drive. Here’s how your Inkscape-made profile pic can look:

(Featuring the face of Carl Nilsson-Polias, one of Google Search’s most famous faces – his face is among the top results when you Google ‘profile picture’. 😝 You’ll need:
  1. A computer with internet access – desktop or laptop;
  2. Inkscape – you can install on your PC or just download the portable version (or, for Mac OS users, follow these steps).

Let’s begin

1. Set up your workspace

Since a Facebook profile pic is only 180 × 180 pixels, we need to make your Inkscape document square. Here I set it up to 400 pixels wide × 400 pixels high (should be enough for my screen resolution to work with – Facebook will reduce its size on uploading). Make it bigger if you have one of those Retina™ or Ultra HD displays.
Next make two layers: the ‘background’ layer and the ‘overlay’ layer: Use Shift+Ctrl+L command to bring up the layer dialog. Rename the bottom layer (default is ‘layer 1’) as ‘background’ and name the top layer ‘overlay’.

While you’re on the ‘overlay’ layer dialog, set the layer’s ‘blend mode’ to ‘lighten’. What this does is to selectively show colors in your background layer: White elements in the layer below (‘background’ layer) show up as white, grays show up as gray, and blacks show up as whatever colors are in the ‘overlay’ layer (basically making a weird duotone, where black is replaced by color and the grays stay gray):

"Lighten" blend mode in the 'overlay' layer.


The problem with this layer blend mode is that 100% white objects need to be made less opaque (i.e., more transparent) in order to show anything in the layer beneath.

2. Add profile pic

Use the layer dialog to go to the background layer. Drag and drop (or go to File > Import) your desired profile pic to the page. You will be asked to either link or embed it in the Inkscape file. Choose embed if you don’t want to be carrying copies of your profile pic around for Inkscape to link to. Embedding will increase the size of Inkscape files, however. The profile pics, for our purpose, should have a good contrast between the face and its backdrop (preferably dramatic contrast – think Caravaggio) . As much as possible, use a black and white profile pic but you can always use Inkscape’s ‘desaturate’ filter for the job:

Center the profile pic on the page (it should be at least the same size as your document – 400 × 400 pixels in this case). To center, do Shift+Ctrl+A and the align dialog will pull up. Center horizontally and vertically relative to page:

3. Add the flag overlay

Now go back to the ‘overlay’ layer and import your flag overlay (you can just drag-and-drop the file on Inkscape).
Where can you find a country flag? Search Wikipedia for ‘Flag of ’. Wikipedia usually has them in two formats: bitmap (PNG or JPG) and vector (SVG). (Here’s a video comparison between bitmap and vector graphics.) SVG is Inkscape’s native file format so importing SVGs is as easy as drag and drop:

Recall that you have to make pure white objects in the ‘overlay’ layer less opaque (via the Fill > Opacity slider) in order to show objects in the layer below.
Vector formats allow for greater control because, not only do they afford a sharp output, you can also set the white components’ opacity to 70.8 (or less – adjust to your liking – I find 70.8% lets me see underlying image details while still hinting the overlay is "white") while having the other colored components at full opacity (and therefore, full saturation). If you only have a bitmap flag, and it has a white component, you need to set the whole image’s opacity to 70.8 (or less, adjust to your preference) so the white will show something from the background layer but this results to making the other colors dull (as shown below).

Bitmap Overlay

Here we have a bitmap flag in the overlay layer. Since it is just one image, all the colors in the flag will have an opacity of 70.8 when we adjust the opacity slider so that the white portions will show something underneath. This makes the colored portions dull (except black) – like in most profile pic overlay sites (e.g. ProfilePictureFlag.com or ProfileOverlays.com):
Bitmap overlay: the other colors become less saturated when we adjust the opacity to allow the background to show through the white portions.

Vector Overlay

Here we have a vector flag (SVG downloaded from Wikipedia). Notice we only adjusted the opacity of the white portion of the flag while the other colors have full saturation:
Vector overlay: We can leave other colors at full saturation while only decreasing the opacity of the white portions.
(Also notice, with vectors, we can also reduce the size of the flag to a square without distorting the Iraqi flag’s calligraphy.) Here they are side by side (bitmap left; vector right):


I like the fully-saturated colors on the right, but your tastes may differ.

More on whites

There’s a bit of an advanced trick that needs to be done if your vector flag has ‘white-on-color’ components. Since vector objects are ‘piled’ one on top of another, if a vector flag has a colored background and white components, white objects tend to be on top of the colored background. If we just decrease the opacity of the white portion, a light version of the color of the background will show through, along with your picture in the background layer. Here, a flag has a green background and a white circle on top of it. We just adjusted the opacity of the white circle to 70.8:

It’s not pretty. The trick is to make a hole in the colored background so the white portion is unimpeded (and the white stays uncolored). Here’s one with a hole (covered by the white component with opacity reduced to 70.8):
This is the effect we want. Here’s the same pic showing the hole (which is the same size and shape as the white circle):

What you need to do is to get inside your flag group (if your flag is grouped, which usually is the case) by right-clicking the group and selecting ‘Enter group ...’ in the dropdown. Next select the white object. Make sure it is not a group but a whole path. Duplicate it (Ctrl+D; if you didn’t adjust the duplicate distance setting, you won’t notice that the object was already duplicated because the duplicate would be over the original object). Select the duplicate object and then press Shift and select the background object. You’ll have two selected objects, the duplicated white object and the colored flag background. Make sure both are paths, not groups (ungroup grouped components; Ctrl+U), and do a ‘Difference’ path operation. This will delete the top object (the reason why we duplicated it first) and make a hole on the flag background. Then reduce the opacity of the remaining white object:

(This could get tricky if you have a white object on top of several colored backgrounds – in the Philippine flag below, for example, I had to duplicate the white triangle twice and use the duplicates one by one to cut portions off the blue and red components.)
Interestingly, color-over-white doesn’t seem to have a problem. Also, you won’t have this problem if your overlay is a bitmap.
Export (Shift+Ctrl+E) the whole page as PNG and you’ll be able to upload it to Facebook as your profile pic.
Also note the main difference of this technique from the conventional method of overlaying a colored transparency over your photo is that, here, what becomes colored are the black areas, while in the conventional method, the white areas are the ones colored. The method we have here keeps flag colors bright and image contrast relatively high (unless your flag has a lot of ‘light’ colors that don’t go well with white like yellow, or orange). ;-)
Here are sample profile pics with different flags (bringing back in Carl Nilsson-Polias):
Like whites, you might also need to reduce the opacity of yellows for clarity. I didn't reduce the opacity of yellow here.
Have fun with Inkscape. ;-)
###

Comments

Popular posts from this blog

Create 'Fake Identity Generator'-style email addresses and passwords in Excel

Last week I needed to compile a list of several hundred fake customer names with fake (but verifiable) email addresses and passwords to test a client's eCommerce site. Fake data generators At that time, I knew of only two online identity generators: Fake Identity Generator  (FIG) and GenerateData.com  (GD). By accepting three user-specified parameters (country, gender, age range) FIG outputs a lot of nice fake data, including disposable (but accessible) YopMail email addresses and relatively easy-to-remember passwords. However FIG doesn't provide free bulk identity generation so I had to generate and copy-paste identities one at a time – a very slow process – along with manually creating accounts using these fake identities at the client site (I had no access to the client content management system so I couldn't bulk register the fake identities). On the other hand, GD allows bulk generation of identities (up to 100 at a time) for free (and with more paramete

Make a quick-&-dirty repeating pattern in Inkscape (using hexagon base)

[Note: This was first published as a Facebook Note on January 29, 2016 . I am making it available here to add to the Inkscape pattern tutorials.] This is based on a tutorial for making hexagonal tiles for David White’s “The Battle for Wesnoth”, but you can skip the 72×72-pixel requirement. You can make your base hexagon in any size that looks good at 100% zoom. First, make a hexagon using the “Create stars and polygons” tool. Press the CTRL key while you’re dragging the cursor to make a proportioned hexagon like this: You may have to move the cursor around to have the hexagon lie on its side. Next, with the hexagon selected, remove the outline by holding SHIFT and left-clicking the ‘X’ swatch in the color palette: Replace the hexagon’s color with what you want by left-clicking the color swatches in the color palette – almost black, in this case: Next, add your main decoration. I just dropped-in a dragon I found at Wikimedia Commons: Group the hexagon and the object (selec

Queen City of the South, Cebu logo

Two years ago I was assigned to design the website logo of QueenCityCebu.com , a popular Facebook page on all things fun to do in Cebu. The original Facebook page profile pic is the one below (actual size), and my boss wanted a similar "crowny" feel to the new logo: I'm a sucker for symbols. Aside from the Sto. Niño, the second most obiquitous symbol for Cebu is the Magellan's Cross  shrine/chapel, as can be seen in the Cebu City seal (the pûsô  is probably the third): Since I'm lazy, I decided to go via the Magellan's Cross route. I wanted to combine the Magellan's Cross chapel with a shape that recalls one of those bulbous European crowns, like the Spanish royal crown ( corona tumular )– which is a bit appropriate, Cebu having been the first major area to be under the Spaniards in their conquest of these islands (and the corona tumular resembles that in some depictions of the Sto. Niño): Ellis Manuel Mendez' personal replica at Fli