protected function parseJpeg()
{
// Add the image to the _objects array.
$colorMode = strtolower($this->img->getColorMode()) == 'srgb' ? 'RGB' : $this->img->getColorMode();
$colorspace = $this->img->getColorMode() == 'CMYK' ? "/DeviceCMYK\n /Decode [1 0 1 0 1 0 1 0]" : "/Device" . $colorMode;
$this->objects[$this->index] = new Object("{$this->index} 0 obj\n<<\n /Type /XObject\n /Subtype /Image\n /Width " . $this->img->getWidth() . "\n /Height " . $this->img->getHeight() . "\n /ColorSpace {$colorspace}\n /BitsPerComponent 8\n /Filter /DCTDecode\n /Length {$this->imageDataLength}\n>>\nstream\n{$this->imageData}\nendstream\nendobj\n");
}