Freeware & techniques to turn a digital photo into a line drawing

Discussion in 'Digital Cameras' started by Tony Palermo, Dec 27, 2012.

  1. Tony Palermo

    Tony Palermo Guest

    How do you turn a digital photo into a B&W line drawing?

    I was trying to turn a digital photo into a coloring-book style line drawing
    as a present for my kid (she likes to color her own personification).

    The best I came up with in freeware was using The Gimp.
    TheGimp: Filters->Edge Detect->Difference of Gaussians
    DoG Edge Detect: Radius 1=3.0, Radius 2=1.0 px [x]Normalize [x]Invert

    Do you have a better/easier way to turn a JPG into a simple line drawing?
     
    Tony Palermo, Dec 27, 2012
    #1
    1. Advertisements

  2. Tony Palermo

    Savageduck Guest

    For the freeware stuff I will have to leave you in the hands of those
    using the Mighty GIMP and related tools.

    I can only demonstrate the sort of thing (I hope this is what you had
    in mind) which could be done in Photoshop Elements or a full version of
    Photoshop. I use CS5 to get this effect.
    < https://dl.dropbox.com/u/1295663/FileChute/DSC_4907LCO4ew.jpg >
     
    Savageduck, Dec 27, 2012
    #2
    1. Advertisements

  3. Tony Palermo

    Tony Palermo Guest

    Yes, that's exactly what I mean.

    Here is a sample result I got from using the only freeware method
    listed yet to convert a JPG family photo to a coloring book album.

    http://www3.picturepush.com/photo/a/11775521/img/11775521.jpg
     
    Tony Palermo, Dec 27, 2012
    #3
  4. Tony Palermo

    Savageduck Guest

    Well unless somebody steps up with some other ideas that is all I have
    for you. I guess the Adobe route isn't going to fit your OS model and
    freeware requirement. I am sure that there is a solution out there.

    Good Luck.
     
    Savageduck, Dec 27, 2012
    #4
  5. Tony Palermo

    Tony Palermo Guest

    That site does a fantastic job of cartoonizing a photo!

    I think I'll try the entire set I have and make a coloring book
    for my kid using that.

    Does it have a limit on the number of photos?
    And what do they do with the uploaded photos?
     
    Tony Palermo, Dec 27, 2012
    #5
  6. Tony Palermo

    mike Guest

    That's pretty amazing.
    Is there a 10 line overview of the filter techniques/sequence
    you use? Or is it automagic?
     
    mike, Dec 27, 2012
    #6
  7. Tony Palermo

    Savageduck Guest

    I wasn't trying for anything complicated or fancy. I just opened an
    image file I had handy in CS5, duplicated the background layer and
    applied the "color pencil" filter from the standard Photoshop filters
    palette. The result was rendered in color, because Tony indicated he
    was looking for a B&W line drawing, so I just desaturated it.
    All done.
    Here is the progression:
    < https://dl.dropbox.com/u/1295663/FileChute/screenshot_88.jpg >
     
    Savageduck, Dec 27, 2012
    #7
  8. Tony Palermo

    mike Guest

    Cool, thanks
     
    mike, Dec 27, 2012
    #8
  9. GIMP does it just as well as any other program, as there
    isn't much of anything special about the mechanisms
    used. It's more a question of exactly what you decide
    you want, and knowing how to produce that specific
    effect.

    For example, given that you are not looking for a final
    product, but rather an outline that children can
    color... you don't need any fine detail, and you don't
    need dark areas so much as just getting the edges.

    I would suggest playing with pre-processing a little,
    before you run an edge detection algorithm.

    Try things like excessive amounts of Unsharp Mask. Use
    USM rather than Sharpen. A Sharpen tool looks for
    sequences of tonal variations such as the hair on a
    person's head, and increases the contrast between dark
    and light areas. That isn't what you want! USM looks
    for single tone transitions, for example the edge
    between the person's hair and their face, and treats the
    area of hair as an average of the tone variations there.

    Also you can try different combinations of more contrast
    and more brightness for the entire image. Unlike with a
    regular photograph, in this case apply USM first and
    other edits afterwards.

    Then try the edge detection algorithms. And afterwards
    try once again to see what both USM as well as contrast
    and brightness adjustments do.

    I got such a kick out of your picture too. The little
    boy looks very much like a fellow I used to babysit at
    that age (he is 11 now). There was a little girl like
    that one who visited now and then, and one day when I
    said I was going to hug him, she told me it just was not
    allowed. She was going to give him all the hugs and
    kisses he needed! So I asked her if it would be okay if
    his mother hugged and kissed him, and she thought for a
    few seconds and allowed as how she might let his mom hug
    him, now and then... :)
     
    Floyd L. Davidson, Dec 27, 2012
    #9
  10. Tony Palermo

    J. Clarke Guest

    You might want to take a look at inkscape
    <http://sourceforge.net/projects/inkscape/?source=dlp>. It has tracing
    capabilities similar to Illustrator. You'll have to do some fiddling to
    get the degree of trace that you want, and like most GPL freeware it's
    poorly documented so you're pretty much on your own figuring out how the
    settings work. By default it traces every little thing and gives you a
    lot more detail than is generally useful.

    I'm not saying it's better than the options that have already been
    proposed, but it's another option worth looking at IMO.
     
    J. Clarke, Dec 27, 2012
    #10
  11. Thank you for that advice.

    1. installed Inkscape (version 0.47 r22583, built Aug 21 2010)
    on my Centos 6 64-bit computer using the following command:

    $ sudo yum install inkscape

    Which installed the following:
    - inkscape x86_64 0:0.47-6.el6

    And, which also installed these 7 dependencies:
    - ImageMagick-c++.x86_64 0:6.5.4.7-6.el6_2
    - atlas.x86_64 0:3.8.4-2.el6
    - gc.x86_64 0:7.1-10.el6
    - gsl.x86_64 0:1.13-1.el6
    - libwpg.x86_64 0:0.1.3-4.1.el6
    - numpy.x86_64 0:1.4.1-9.el6
    - python-nose.noarch 0:0.10.4-3.1.el6

    2. I selected the new menu selection:
    Applications->Graphics->Inkscape Vector Graphics Editor

    4. I opened the original kids1.jpg file:
    Inkscape: File->Open->/tmp/kids1.jpg
    http://www2.picturepush.com/photo/a/11776425/img/11776425.jpg

    5. Then I simply selected the following menu items:
    Inkscape: Edit->Select All
    Inkscape: Filters->Image effects->Pencil
    Inkscape: File->Save As->/tmp/kids2.jpg

    6. I then saved the results as (kids2.jpg) and put both side by side:
    $ convert kids1.jpg kids2.svg +append kids3.gif

    Here is the result, side by side:
    http://www2.picturepush.com/photo/a/11776480/img/11776480.gif

    I'm trying to figure out how to darken and sharpen the lines, but,
    Inkscape appears to do the job quite nicely. Thanks!
     
    William Don**ly, Dec 27, 2012
    #11
  12. Some good choices have already been mentioned. You may also have a
    look at FotoSketcher:

    www.fotosketcher.com

    Apart from this, looking for Adobe 8bf filter plugins may be worth
    a try, since they are not only supported by payware, but also by
    freeware like IrfanView or XNView.

    For a quick&dirty way to get outlines, I sometimes just use Relief
    and Emboss filter in IrfanView Effect Browser in a row. The result
    has to be converted to b/w by Decrease Color Depth, afterwards.

    Relief and Emboss carve the outlines more sharply from background
    than any of those filters used separately. Since Relief has no
    settings attached, it should be used first. The setting for the
    Emboss filter should be chosen in a way, that only few details are
    kept visible inside the outlines.

    BeAr
     
    B. R. 'BeAr' Ederson, Dec 27, 2012
    #12
  13. Tony Palermo

    Dave Guest

    Dave, Dec 27, 2012
    #13
  14. Tony Palermo

    George Kerby Guest

    Don't know about software, but there is a great app made just for that
    called "Sketch Me!" for the iPhone.

    <https://itunes.apple.com/us/app/sketch-me!/id364365478?mt=8>

    Sounds like just what you're looking for.
     
    George Kerby, Dec 27, 2012
    #14
  15. Wolfgang Weisselberg, Dec 27, 2012
    #15
  16. Tony Palermo

    Tony Palermo Guest

    Thanks for that suggestion.

    Having never installed a freeware Gimp plugin before, I wrote this up
    for others to benefit, which uses that suggested "Pencil-Drawing" plugin.

    0. Choose a picture to turn into a line drawing, e.g., /tmp/kids1.jpg
    http://www1.picturepush.com/photo/a/11780489/img/11780489.jpg

    1. Download the script-fu-pencil-drawing.scm script to /tmp from
    http://registry.gimp.org/node/22018

    2. Read up on how to handle "scm" files for The Gimp:
    http://registry.gimp.org/node/13950

    Which says:
    If it ends in .scm, put it in the scripts folder.
    If it ends in .exe, put it in the plugins folder.
    If it ends in .py, put it in the plug-ins folder.

    3. Since it ends in scm, locate the proper scripts folder:
    $ sudo updatedb; locate gimp| grep -i script
    REPORTS: /usr/share/gimp/2.0/scripts/ & ~/.gimp-2.6/scripts/

    4. Both directories worked for me, so use your personal preference:
    $ sudo cp /tmp/script-fu-pencil-drawing.scm /usr/share/gimp/2.0/scripts/.
    or
    $ cp /tmp/script-fu-pencil-drawing.scm ~/.gimp-2.6/scripts/.

    5. Load the photo to be converted into The Gimp, version 2.6:
    $ /usr/bin/gimp kids1.jpg &

    6. Convert the picture to a coloring book pencil line drawing & save:
    Gimp: Filters->Pencil-Drawing->Blur Radius=4, Strength=1, OK
    Gimp: File->Save As->/tmp/kids2.jpg

    7. Compare the results, side by side:
    $ cd /tmp; /usr/bin/convert kids1.jpg kids2.jpg +append kids3.jpg

    See results here:
    http://www3.picturepush.com/photo/a/11780526/img/11780526.jpg
    ==============================================================
    Note: Compare results with this TheGimp basic freeware method:
    $ /usr/bin/gimp kids1.jpg &
    TheGimp: Filters->Edge Detect->Difference of Gaussians
    DoG Edge Detect: Radius 1=3.0, Radius 2=1.0 px [x]Normalize [x]Invert
    RESULTS: http://www3.picturepush.com/photo/a/11775521/img/11775521.jpg

    Note: Compare results with this Gimp plugin script freeware method:
    $ cp /tmp/script-fu-pencil-drawing.scm ~/.gimp-2.6/scripts/.
    $ /usr/bin/gimp kids1.jpg &
    Gimp: Filters->Pencil-Drawing->Blur Radius=4, Strength=1, OK
    Gimp: File->Save As->/tmp/kids2.jpg
    RESULTS: http://www3.picturepush.com/photo/a/11780526/img/11780526.jpg

    Note: Compare results with the Inkscape freeware method:
    $ /usr/bin/inkscape /tmp/kids1.jpg
    Inkscape: Edit->Select All
    Inkscape: Filters->Image effects->Pencil
    Inkscape: File->Save As->/tmp/kids2.svg
    RESULTS: http://www2.picturepush.com/photo/a/11776480/img/11776480.gif

    Note: Compare results with the Cartoonize freeware method:
    http://www.cartoonize.net/
    Upload photo from disk: /tmp/kids1.jpg
    Select the 15th cartoon effect (3rd column, 5th row)
    Press the "Cartoonize Now" button & save the results.
    RESULTS: http://www3.picturepush.com/photo/a/11780666/img/11780666.jpg

    Which do you think is best for a family coloring book for toddlers?
     
    Tony Palermo, Dec 27, 2012
    #16
  17. Tony Palermo

    Tony Palermo Guest

    This FotoSketcher suggestion (www.fotosketcher.com) looks like a great
    Windows freeware program to convert family photos to coloring books.

    I don't see FotoSketcher in any of the Linux repositories though. :(

    $ yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* provides "*/fotosketcher"
    $ netscape http://pkgs.repoforge.org (look for fotosketcher) &
    $ netscape http://pkgs.org/search/?keyword=fotosketcher &

    So, I can't test it out (but others can post the results here for us)!
     
    Tony Palermo, Dec 27, 2012
    #17
  18. I didn't see you requesting a /Linux/ solution, either. ;-) You added
    alt.os.linux only /after/ your OP.

    FotoSketcher (esp. the portable version) and IrfanView (my other
    suggestion) should both run fine with Wine under Linux, though.
    Therefore you should be able to test those solutions by yourself.

    FotoSketcher can create very differently looking pictures, that all
    may be suited for your purpose. One example using b/w pencil2 with
    settings Edge threshold 0 | Edge intensity 150 | Stroke length 35 |
    Darken/Lighten 255:

    http://picturepush.com/public/11781589

    A sample outcome from IrfanView with Relief and Emboss_32 filter:

    http://picturepush.com/public/11781633

    Apart from Wine solutions, the already suggested ones for Gimp
    and Inkscape should do everything you need. If you also accept
    command line solutions, you should take a closer look at either
    ImageMagick or GraphicsMagick:

    www.imagemagick.org
    www.graphicsmagick.org

    Both run natively on Linux and provide "everything" you may ever
    think of with regard to image manipulation. - Although it /may/
    happen, that nobody will be able to tell you the correct settings
    for the more obscure wishes... ;-)

    HTH.
    BeAr
     
    B. R. 'BeAr' Ederson, Dec 27, 2012
    #18
  19. Tony Palermo

    Tony Palermo Guest

    Ah. Indeed. My mistake. Yes. I added Linux after the fact, which
    wasn't fair. Plus, I'll wager most a.c.f readers are on Windows
    anyway - so they can benefit from the proposed FotoSketcher & Irfanview
    methods.
    Good point. I have imagemagick.
    I couldn't find graphicsmagick on first inspection, but I'll dig deeper.

    I didn't know they had a JPEG to pencil-drawing feature.
     
    Tony Palermo, Dec 27, 2012
    #19
  20. Tony Palermo

    J. Clarke Guest

    Inkscape has another way to do it--Path/Trace Bitmap. That gives you a
    vector drawing. Try that and select "edge detection".
     
    J. Clarke, Dec 28, 2012
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.