Wednesday, January 03, 2007

Man I Love Writing Software…

Even when I’m not getting paid to do so...

I had a couple of hours last evening and decided to look into a problem a good friend asked me to help him solve.

He’s a photographer, and has a fairly extensive website that displays his work. Up until now he’s had to run each of his photos through a manual process to place a ‘Proof’ bar across the picture before posting it to his website.

The idea was, how can we, programmatically, run a series of pictures through a process to place a ‘proof-mark’ across the photo? Doing that allows the picture to be seen, and appreciated, yet prevents it from being taken and used elsewhere with out him being compensated for his efforts.

Well, truth be told he asked me to look into this many, many, months ago, and I’m sure he thought I’d either forgotten about it, or given up on writing something to address his need.

For whatever reason, last night I was thinking about all the other Windows API functions I’d been able to employ to handle FTP downloads both from the internet and from the Main Frame at the job, that I decided to look into the GDI portion of the API and see what I could come up with.

So, for a couple of hours I wrestled with the rather terse (to me) GDI documentation, and attempted to read, and rewrite a picture, then a picture with some text added, then added a ‘bar’, then placed the text in that bar.

Eventually I had an, admittedly incomplete, little application that will read an image file, create a semi-transparent rectangle and place some text inside the rectangle that’s fairly centered as well.

Now this might not seem like much to some of you, but I assure you I was close to dancing on the desk once I got this working.

If he thinks it will meet his needs, I'll tweak it just a bit to provide an interface and he’ll be able to specify a source and target directory and just click “Go” and have all the images in that directory ‘Proofed’ in one shot…

This is not rocket science, but it is definitely one of the things I love about writing software… being handed a problem and then finding a way to solve it.

The best part? That I did it in FoxPro of course… That language that no one seems to have an interest any more, but that continues to ‘come through’ in every situation I toss at it. It’s really a shame it doesn’t get the respect it deserves!

Here’s a sample of a before:



And the after:



Keep in mind folks, this is a language designed to manipulate databases, NOT images.

Again, it’s not software to cure a disease, or change the world, but a little (less than a couple of hundred lines of code) application that does exactly what I set out to do.

It’s also a little project I had a ton of fun wrestling with!!


Technorati Tags: - - -
-IceRocket Tags: - - -

9 comments:

Garrett said...

Re: dancing on the table -- boy, do I know how that feels. I haven't really gotten that feeling lately, though -- I need to come up with something crazy to work on to provoke it. :-)

Bill said...

Thanks Garret... It's been awhile for me as well. I dropped by your blog, I like what you've been doing with the API. If you're still working on an FLL for the Levenstein Distance, drop me a note, maybe we could collaborate on an FLL that's a bit larger and contains a few more comparators as well.

jenbeauty said...

stopping by to say Happy New Year!!

Unknown said...

I'm with you, Bill. Every now and then, I get to step away from project leadership and do some real programming. I savor that fun.

Bill said...

Hi Jen, and Happy New Year to you as well!

Hiya CA, it sort of renews me somehow and as of late I'm doing less and less of it on the job... maybe I'll actually write something neat this year just for fun!

Bhuwan said...

That was the perfect way to start a new year.
Write code and get to smile about it!

~Bhu1

Bill said...

Bhuwan, you know, I hadn't thought about it that way... but, you are just exactly right! Thanks for stopping by

Garrett said...

I never got around to it. Maybe this would be a good time to try again... I'll let you know if it gets anywhere.

Bill said...

Thanks Garrett I'm ready when you are.