Hello Bar

Showing posts with label sketch. Show all posts
Showing posts with label sketch. Show all posts

Thursday, June 13, 2013

Quick and Easy Pencil Sketches

In this short project you will learn how to use GIMP to quickly and easily  get a pencil sketch effect.



Note that the settings used in this tutorial work for the image I used. They can vary widely to achieve desired results for different source images. If you would like to download the picture I used in this tutorial, click here.

Open the image that you want to modify. Duplicate the image layer, Layer - Duplicate Layer.



Desaturate the duplicate layer, Colors - Desaturate..., Choose shade of gray based on: Lightness in the dialog.



Now, use the Edge-Detect filter on the duplicate layer to get the basis of the sketch effect, Filters - Edge-Detect - Edge..., select the Roberts Algorithm from the drop down menu,  set the Amount to 5.



Invert the colors on the duplicate layer, Colors - Invert.



Reduce the Opacity using the controls in the Layers pallet. I turned it down to 50%.



To get a black-and-white sketch quickly, the process is almost identical.



However, after you duplicate the image layer, go to the Colors menu and select Desaturate..., Choose shade of gray based on: Luminosity. Duplicate the desaturated layer and continue as above.


  • Filters - Edge-Detect - Edge...

    • Algorithm (Roberts) - Amount (5)

  • Colors - Invert

  • Reduce Opacity (75%)



This text tutorial is based on a YouTube video tutorial by Techtonicc.



Monday, April 30, 2007

High Pass Filter Sketch Effect (GIMP)

Text and images Copyright (C) 2004 Vidar Madsen and may not be used without permission of the author.

Meet Marius, my son. :)

Before:
After:

1. High pass filtering

High pass filtering means that we filter away the low frequencies of something, and let the high frequency bands pass. In image terms, this means that the detail of an image is kept, while the larger scale gradients are removed. Luckily, it's not as complicated as it sounds.

First, duplicate the layer.

Then Gaussian Blur the top layer with an appropriate radius.

You need to experiment to find good values, but roughly speaking one can say that the larger the radius, the wider the high pass filter's frequency response, and the "fatter" the lines in the final sketch. In this example I used 7 pixels, giving this result;

Now we have a low pass filtered version of our image; all gradients and no detail. Exactly the opposite of what we wanted. So, how do we obtain a high pass filtered version? Why, we subtract it from our original, of course. A good way to do that is to simply Invert the image, and blend it 50-50 with the original. First, Image->Colors->Invert;

Then, to blend the two, we adjust the Layer's Opacity slider to 50%, and our high pass filtered image appears;

Now it's time to Merge the two layers, so that we can continue to process them as one. Right-click on the top layer and pick Merge Down.

Now, back to the image. Was the effect a bit too subtle, perhaps? While not necessary, we can apply the Levels tool (Layer->Colors->Levels) to increase the contrast a bit, so that it's easier to inspect visually. In this example, I set Input Levels to 100-155;

2. The sketch part

Now it's time to make the image background white. First, Layer->Colors->Desaturate the image, and fire up that Levels tool again. Here you need to experiment a bit to find the best values for your image. But you will most likely want to set max Input Level (the right value) to 128 or thereabout. This makes the 50%-grey part of the image go white, which is a good start. (If you look at the Levels histogram, you should notice a strong peak in the middle. This is where we want the Max Input Level.)

The primary target of experimentation would be the gamma value field in the middle (the grey triangle just below the histogram). With a bit of tweaking, you could end up with something like this;

That's pretty much it. I tend to want to hand-polish my images to get rid of various imperfections, though. Below is the result of softening the contrast on the lower right region, which is where the bright skin fell against the black background; The higher the contrast, the stronger the lines. I also fine-tuned the overall contrast (with Levels) to get rid of some of the noise in the face;

Finally I wanted to remove the annoying shadow below his chin and some of the specks scattered around his face, so I manually hand-brushed away parts of it, giving the final result;

Voila. That's it. Hope you liked it. :)

Photo to Sketch

Tutorial on how to make a nice baby & daddy photo into a nice baby & daddy painting.

Text and images Copyright (C) 2002 Dave Neary and may not be used without permission of the author.

1. Original image

Nice picture of a baby & dad. Ah.

2. After a Sobel edge detect

Straightforward Sobel edge detect ( Filters -> Edge-Detect -> Sobel) of original (don't forget to save a copy of the original) The Sobel edge detect should be done on the background image (without an alpha channel) rather than a copy of the background (which has an alpha channel).

3. Equalised & desaturated Sobel

Bring out detail with an auto-equalise ( Layer -> Colors -> Auto -> Auto-Equalize) of the sobel edge detect, and convert it to greys using desaturate ( Layer -> Colors -> Desaturate).

4. Curves window for how to do a highpass filter

We only want the strong edges, otherwise it'll look crap. To get them, we eliminate the edges with small magnitude. The easiest way to do this is with the curves tool ( Image -> Colors -> Curves) like this.

We set the curve type to free (which allows discontinuities), and then for the bottom 3/4 of the curve (or thereabouts) to 0. Just drag the mouse/pen along the bottom of the curves tool.

5. Image after the highpass

The result is much cleaner. The only problem is it's white-on-black, when we want black-on-transparent ideally.

6. L&C dialog for creating an edges mask

Small trick to get to black-on-transparent. Invert the Sobel edge detect (you did keep a copy, right?) with Layer -> Colors -> Invert and apply our highpass-filtered copy as a mask. To do this, open the Layers & Channels dialog (if it's not open already), and add a layer mask to the layer with the inverted edge detect layer ( Edit -> Copy with the highpass layer selected, Add Layer Mask with the inverted edge layer selected, then select the mask and Edit -> Paste) Since we kept the strong edges in the highpass filtered layer, this means that we end up with a rather nice black-on-transparent layer.

7. Save of the image above to show effect

This is the result of the trick above. It's shown here with a white layer behind it. We could stop here, and this is a decent sketch effect. For the colouring, we need some more work (mostly slogging, though).

8. L&C dialog with set-up for the colouring trick

images,original image & colouring layer in overlay mode

We put our original image back in the background, and set the white layer to overlay (as we see here) - this means we can see the coloured areas behind the white layer - this is extremely helpful when we're painting the white layer, as sometimes the edges are rather fine, or are in the middle of an area that's more or less the same colour.

9. Colouring looks after doing one area of the image

Using the colour-picker tool (looks like an eye-dropper), we select the colour we want to paint from the original image (just activate the "original image" layer and try to pick a colour representative of an area), and then we re-activate our colouring layer, which is still in overlay mode. Using a big brush (with the brush tool for more natural edges) we fill in the area of that colour roughly (doesn't have to be perfect). You should see the colour darkening as we draw with a colour similar to the background colour.

10. Colouring layer in normal mode

This is what we see if we set the colour drawing layer to normal mode. And we're on our way.

11. Finished with a completed colour layer

After some effort, all the regions get filled in. Final touches to make faces and the like look better for shadows and highlights were accomplished by selecting a representative shadow/highlight colour, and adding the extra bits with the airbrush tool (looks like an airbrush). After all our work, we end up with this very nice looking painting effect.