Mike42\Escpos\ImagickEscposImage::getColumnFormatFromFile PHP Method

getColumnFormatFromFile() protected method

protected getColumnFormatFromFile ( string $filename = null, boolean $highDensityVertical = true ) : string[] | null
$filename string Filename to load from
$highDensityVertical boolean True for high density output (24px lines), false for regular density (8px)
return string[] | null Column format data as array, or NULL if optimised renderer isn't available in this implementation.
    protected function getColumnFormatFromFile($filename = null, $highDensityVertical = true)
    {
        if ($filename === null) {
            return null;
        }
        $im = $this->getImageFromFile($filename);
        $this->setImgWidth($im->getimagewidth());
        $this->setImgHeight($im->getimageheight());
        /* Strip transparency */
        $im = self::alphaRemove($im);
        $im->setformat('pbm');
        $im->getimageblob();
        // Forces 1-bit rendering now, so that subsequent operations are faster
        $im->rotateImage('#fff', 90.0);
        $im->flopImage();
        $lineHeight = $highDensityVertical ? 3 : 1;
        $blobs = $this->getColumnFormatFromImage($im, $lineHeight * 8);
        return $blobs;
    }