function PixelsToStream() { // Make a new bit stream for the image $BitStream = new BitStream($this->Image->GetBoundry()); // Move to the start pixel $this->Image->StartPixel(); // While we have bits and pixels while (!$this->Image->EOF() && !$BitStream->EOF()) { // Get the current pixels RGB value $Pixel = $this->Image->GetPixel(); // Write the pixel data to the bit stream $BitStream->Write($Pixel); // Move to the next pixel $this->Image->NextPixel(); } // If we got to the end of the image if ($this->Image->EOF()) { // Then we never found our secret data $BitStream->Stream = ''; } // Overwrite the main bit stream with our new one $this->BitStream = $BitStream; }