Mike42\Escpos\ImagickEscposImage::getRasterBlobFromImage PHP Méthode

getRasterBlobFromImage() private méthode

Will crash out on anything which is not a valid 'P4' file.
private getRasterBlobFromImage ( Imagick $im ) : string
$im Imagick Image which has format PBM.
Résultat string raster data from the image
    private function getRasterBlobFromImage(Imagick $im)
    {
        $blob = $im->getimageblob();
        /* Find where header ends */
        $i = strpos($blob, "P4\n") + 2;
        while ($blob[$i + 1] == '#') {
            $i = strpos($blob, "\n", $i + 1);
        }
        $i = strpos($blob, "\n", $i + 1);
        /* Return raster data only */
        $subBlob = substr($blob, $i + 1);
        return $subBlob;
    }