<?php #!/usr/bin/php # # enhanceLSB.php # # Utility to 'enhance' the LSB in a Windows BMP file # $bmpHeaderLength = 200; $byteCounter = 0; $bmpHandle = fopen ("file2.bmp", "r"); $outputHandle = fopen ("output.bmp", "a"); while ($byte = fgetc($bmpHandle) { if ($byteCounter > $bmpHeaderLength) { // if LSB = 1 then set entire byte to 1 if ($byte & 1) { $byte = 1; } } $byteCounter++; fwrite ($outputHandle, $byte); } fclose ($bmpHandle); fclose ($outputHandle); ?>