1

I already offer a Sepia Effect for images uploaded to a site using something like this:

    Dim SepiaMatrix As New ColorMatrix(New Single()() {
     New Single() {0.493F, 0.349F, 0.272F, 0, 0},
     New Single() {0.769F, 0.686F, 0.534F, 0, 0},
     New Single() {0.289F, 0.168F, 0.131F, 0, 0},
     New Single() {0, 0, 0, 1, 0},
     New Single() {0, 0, 0, 0, 0}})
    ...
    Attributes.SetColorMatrix(SepiaMatrix)
    ...
    Gfx.DrawImage(Image, New Rectangle(0, 0, Image.Width, Image.Height), 0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, Attributes)

I'd also like to offer a brush and sketch effects [Edit: That is to say that when a photo is uploaded, my app applies filters to the photo in such a way it looks like either brush strokes or crosshatching and "drawn" lines - Exactly like an artists sketch. ]

I've seen This Question but it's not very clear what the solution is and I'd prefer not to have to install a Java IDE and go crawling through the very advanced/flexible Java library mentioned.

Can someone provide a link to a good tutorial (.Net 3.5+ by preference but any language at all will do) or provide me with a basic list of steps I need to apply in order to achieve my goals.

I once found a Wiki with detailed step-by-step image manipulation in PHP but haven't been able to find it since. If anyone knows of it, I believe it had an example of a sketch effect. The site used a predominantly blue image of a planet in space as the test case.

Many thanks for your help.

Community
  • 1
  • 1
Basic
  • 26,321
  • 24
  • 115
  • 201
  • Can you clarify what kinds of effects you mean? – Pekka Sep 18 '11 at 21:33
  • a Sketch effect - which is to say give it a photo, it detects edges and "draws" them the way a human artist would (at least a very mechanical one!). It also "fills" or cross-hatches other areas as appropriate. I've seen different quality attempts at this in various graphics apps including PhotoShop. The other (brush) effect is very similar except that instead of pencil lines, it uses brush strokes. – Basic Sep 18 '11 at 22:35
  • Since you mention PHP - does this help? [Turning photo into cartoon using PHP](http://stackoverflow.com/q/4062365) – Pekka Sep 18 '11 at 23:10
  • @Pekka Thanks, I hadn't found that! It's the right idea but there are a couple of problems... it's using the imagemagick app which would add dependencies to my code - I'm trying to avoid that as the image processing is a library in itself and imagemagick is not common on IIS machines. Also, I'd like to know how to do it so I can tweak it as much as I like rather than rely on someone else's app. That said, thanks for the suggestion – Basic Sep 19 '11 at 03:16

1 Answers1

3

The aForge project is an open source set of libraries that does imaging filters (alongside many other things). They have a filter for Oil Paint (not exactly what you asked for, but it will be instructive: http://code.google.com/p/aforge/source/browse/trunk/Sources/Imaging/Filters/Other/OilPainting.cs . As well someone has created a PencilSketch filter based on the aForge library, and you can see it's source code here: http://blendfilter.codeplex.com/SourceControl/changeset/view/67619#1218773 .

Kris Erickson
  • 33,454
  • 26
  • 120
  • 175