So, once I had the system working (upon which I would build the icon maker) I decided ugh I should probably start on the next part. Sure, I was excited to try out my fancy new binary interface, but this pending portion suffered from a drastic decrease in fun and relative increase in tedium.
The logical process went a little something like this:
- Read in an image.
- Resize it appropriately.
- Fill the icon structures with the appropriate data.
- Save.
Reading the images was fairly easy, I pretty much just stole the code from bgallery, and modified it with the help of php.net.
One time I took a notebook with me to one of my brother’s roller hockey games. While watching the game I wrote out my magic resize function – which didn’t work. So, I fixed that.
As I extracted image data from the images, processed it, and attempted to force it into the icon structs I encountered a number of bugs. To assist in their eradication, I wrote a few functions for displaying the data which were kind of cool. One of them displayed images as coloured characters, and a later version displayed them as coloured 10×10 divs. Also, I wrote a function called Karl which was way more helpful at squishing bugs.
In the end, I had a set of functions that, given an image file, would create an icon resource complete with three 32bit images (48×48, 32×32, 16×16). They preserved transparency in images that supported it, and accepted image formats of JPG, PNG, and GIF.
Since my scripts are set to limit their memory use to 8mb, there are height and width restrictions to the images that can be processed. (width*height*bitcount/8 must be less than 8mb)
You mentioned me again =O I’m famous!!
BradIcon will take over the world?
Didn’t you promise us a link to it in this blog?
i think that will be at the end of the interface blog? 😛
also, you already know where it is!