15/Apr/2010 PA
12/Apr/2009 Sunrise Circus
15/Mar/2009 Lego
08/Mar/2009 Moomba
13/Feb/2009 Car Smokey Sunset
26/Jan/2009 Fireworks
26/Oct/2008 Synchrotron
07/Jun/2008 Model Trains
06/Jun/2008 Wedding
04/Jun/2008 Central Coast Trip
more photos...
03/Nov/2011 yuvvalues
03/Nov/2011 yuvrfps
03/Nov/2011 yuvdiff
03/Nov/2011 yuvaddetect
03/Nov/2011 yuv2jpeg
more lavtools...
The TRIP is the mental projection of my digital self. Including all areas of digital work I have been involved with, including Music, video, photography...
All good web pages must have the collection of absolutely useless pictures. Designed for no purpose other than to consume kilobits. And hopefully show off some of my Photographic skills. Web design skills, and uses one php script to drive the whole index. Also see the Photography section of the Silicontrip Website.
The Creative section of the TRIP is my imagination trying to run free. I have a fascination with sexual, spiritual and meta physical abilities, and these stories show it.
Part of the images directory contains some of my digital artwork. These images have been created or enhanced by myself, with the help of the 1s and 0s machine.
23/Feb/2011 Trace
17/Jan/2010 Food
30/Oct/2009 Airbrush
18/Jun/2009 Focal
01/Jun/2009 Transport
01/Jun/2009 Misc
31/May/2009 Artwork
24/Apr/2009 AirbrushScales
18/Apr/2009 Probe
10/Jan/2009 Scanimation
more album...
27/Jan/2012 ZFS for OSX
14/Dec/2011 Scripting Bridge
02/Dec/2011 Core Audio Units
01/Mar/2011 A useful bit of code
22/Dec/2010 Larger than 4G files on FAT for OSX
08/Dec/2009 Time machine on non HFS drives
21/Oct/2009 My Strengths
27/Aug/2009 Train Hitchiking
11/Jul/2009 A litre of onions
19/Jun/2009 FSCK for NTFS
18/Jun/2009 Automated Focal Deconstruction
12/Jun/2009 Perl code to write BMPs
07/Jun/2009 More Lego
01/Jun/2009 Latest Airbrushing
30/May/2009 Happy Birthday to me
24/May/2009 Comments Engine
09/May/2009 Skills Matrix
24/Apr/2009 Airbrush simulator
19/Apr/2009 Ben 10 Board game
29/Mar/2009 How fresh is your fresh food?
more blog...
I'm doing image deconstruction in airbrush class. So to aid in visualising the strokes I wrote a quick and dirty perl code.
Uncompressed BMPs are pretty simple to write (and a little more tricky to read). There are basically 2 headers that you need to worry about. The size of the second header determines how it is interpreted. The most common type, I've encountered, is the 40 byte header.
read(FILE, $header,14);
($magic,$size,$res1,$res2,$start) = unpack ("a2LSSL",$header);
read(FILE, $hsize, 4);
read(FILE, $dibheader, unpack ("L",$hsize) - 4);
$dibheader = $hsize . $dibheader;
if ( unpack("L",$dibheader) eq 40 ) {
($hsize,$width,$height,$planes,$bpp,$comp,$isize,$hres,$vres,$cols,$icols) = unpack("LllSSLLLLLL",$dibheader);
} else {
die "only supports windows style BMP\n";
}
The data is now ready to be read in 3 byte RGB triplets. Of course we should check that $cols is a sane value. I know I should put in code to handle 12 byte DIB headers but the code is trivial.
Writing is even easier because there is a 12 byte header version which requires even less data.
$width = 640;
$height = 480;
$header1size = 14;
$header2size = 12;
$totalheader = $header1size + $header2size;
$filesize = $width * $height * 3 + $totalheader;
$header = pack ("a2LssL","BM",$filesize,0,0,$totalheader);
$dibheader = pack("LSSSS",12,$width,$height,1,8);
print FILE $header . $dibheader;
Now output your 307200 colour pixels. (or 921600 bytes) close the file and you are done. Easier than even CBA netbanking.
I wondered why the 40 byte BMP uses a signed integer for it's image dimensions. It appears that the pixels run bottom to top, if you want a top to bottom bitmap, you can use a negative height. I assume mirroring left to right would work for negative width values.