Page 1 of 1
Create Function: "Manipulation (skew, warp) of text" (bump)
Posted: Wed Jan 23, 2008 8:25 am
by Chalks
I've been reading a lot about captchas recently, and I wanted to make the one I'm currently using actually effective. One of the easiest ways to (begin to) do this is to skew and warp the text in it. However, looking at the gd library, I can't see any function that might help. Searching google didn't help either... I got a lot of photoshop tutorials.
Could someone point me towards relevant functions/libraries (or even tutorials)?
Thanks.
Re: Manipulation (skew, warp) of text
Posted: Wed Jan 23, 2008 8:42 am
by Inkyskin
You can get font's that are already skewed etc, I'd suggest it would be quicker to render too

Re: Manipulation (skew, warp) of text
Posted: Wed Jan 23, 2008 8:53 am
by Chalks
Inkyskin wrote:You can get font's that are already skewed etc, I'd suggest it would be quicker to render too

That's true, and I've done that. The problem is fonts that are already skewed are predictable. In that you can program your bot to recognize a pre-rendered "A", "B" or what have you. So, while rendering the text on the fly will take longer, it's certainly more secure.
Re: Create Function: "Manipulation (skew, warp) of text" (bump)
Posted: Fri Jan 25, 2008 11:16 am
by Chalks
bump. It's been over 24 hours, and it seems no one knows the answer.
So, I will change my original question to this:
How could I begin building a function that _would_ skew/warp text (or, any image)?
I think this would be accomplished by moving selections of pixels around, but I'm not entirely sure.
This (pdf 317kb) is an interesting article that has a mathematical algorithm for reversing skew effects. There may be a way to work that backwards to skew it in the first place.
This article does as well, but the math seems to go more in depth, and I was a bit out of my league when I read it.
As for warping text,
this nifty little GIMP plugin does almost exactly what I'm looking for. The source code is available on the website, but it is written in what looks to be C. I think it could fairly easily be converted to php, but before I start trying, would someone look at it and tell me how robust they think it would be for generating images on the fly? I'm afraid that any warping I do is going to be a fairly significant tax on my server unless I can get some optimized code.
Finally, can anyone else find examples of code (in any language) that perform skew and warp functions? I found it hard to search google for that particular topic.
Thanks