Grafika\Imagick\Image::getImageFile PHP Method

getImageFile() public method

Get image file path.
public getImageFile ( ) : string
return string File path to image.
    public function getImageFile()
    {
        return $this->imageFile;
    }

Usage Example

示例#1
0
 /**
  * Dither by applying a threshold map.
  *
  * @param Image $image
  *
  * @return Image
  */
 private function ordered($image)
 {
     // Localize vars
     $width = $image->getWidth();
     $height = $image->getHeight();
     $thresholdMap = array(array(15, 135, 45, 165), array(195, 75, 225, 105), array(60, 180, 30, 150), array(240, 120, 210, 90));
     // Loop using image1
     $pixelIterator = $image->getCore()->getPixelIterator();
     foreach ($pixelIterator as $y => $rows) {
         /* Loop through pixel rows */
         foreach ($rows as $x => $px) {
             /* Loop through the pixels in the row (columns) */
             /**
              * @var $px \ImagickPixel */
             $rgba = $px->getColor();
             $gray = round($rgba['r'] * 0.3 + $rgba['g'] * 0.59 + $rgba['b'] * 0.11);
             $threshold = $thresholdMap[$x % 4][$y % 4];
             $oldPixel = ($gray + $threshold) / 2;
             if ($oldPixel <= 127) {
                 // Determine if black or white. Also has the benefit of clipping excess value
                 $newPixel = 0;
             } else {
                 $newPixel = 255;
             }
             // Current pixel
             $px->setColor("rgb({$newPixel},{$newPixel},{$newPixel})");
         }
         $pixelIterator->syncIterator();
         /* Sync the iterator, this is important to do on each iteration */
     }
     $type = $image->getType();
     $file = $image->getImageFile();
     $image = $image->getCore();
     return new Image($image, $file, $width, $height, $type);
     // Create new image with updated core
 }
All Usage Examples Of Grafika\Imagick\Image::getImageFile