5

I was wondering what the steps would be to convert a photo into a pencil drawing. People usually suggest to:

  1. invert the image (make negative)
  2. apply Gaussian Blur
  3. blend the above images by linear dodge or color dodge.

See here: Convert Image to Pencil Sketch

Are there other methods? I'd be particularly interested in methods which emphasise the stroke of the pencil, like this iPhone App: Snap and Sketch

I'd be very grateful for any suggestions of how to get started.

Community
  • 1
  • 1
n.evermind
  • 11,944
  • 19
  • 78
  • 122

1 Answers1

4

I think you will have to iterate through all the pixels in the image and implement the algorithm you mentioned in the question itself. There is no default image filtering library in iphone (CoreImage is there but only for Mac). I think your options are

  1. A third party library named imageMagic is there, and these people seems to have ported it successfully to iphone. Something to ponder over.
  2. Another simple image filtering library (especially for iphone) does some basic image filtering. Gaussian blur is one of them.
  3. Implement your own methods by going through each pixel in image..This thread is very useful for image filtering seekers in iphone. They are implementing some filters. At least you will get information about how to go through every pixels of an image.

EDIT: Core Image now present in iphone. I did not get a chance to play with it yet. This is the documentation

Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
  • Thanks for this, very helpful. Too bad that there isn't just a default image filter, though. – n.evermind Apr 28 '11 at 09:58
  • Too bad..I had a similar requirement like this in the past..I want to make a polaroid filter...I asked here, but with zero answers..http://stackoverflow.com/questions/5590216/polaroid-filter-from-uiimage – Krishnabhadra Apr 28 '11 at 10:00
  • Interesting question I have to say! Sounds like a great idea. Once I'm done with the basics, I'll have a look into your code. Having Polaroid-like images sounds like a ver nice idea. Why not start a bounty for it? – n.evermind Apr 28 '11 at 10:03
  • That part of the project was taken away from me..:(..Then they gave me another assignment..Never had time to look back into it...But it is still in mind.. – Krishnabhadra Apr 28 '11 at 10:13