当前位置: 首页>>代码示例>>PHP>>正文


PHP imagegammacorrect函数代码示例

本文整理汇总了PHP中imagegammacorrect函数的典型用法代码示例。如果您正苦于以下问题:PHP imagegammacorrect函数的具体用法?PHP imagegammacorrect怎么用?PHP imagegammacorrect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imagegammacorrect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gamma

 /**
  * {@inheritdoc}
  */
 public function gamma($correction)
 {
     if (false === imagegammacorrect($this->resource, 1.0, $correction)) {
         throw new RuntimeException('Failed to apply gamma correction to the image');
     }
     return $this;
 }
开发者ID:rachelleannmorales,项目名称:aboitiz,代码行数:10,代码来源:Effects.php

示例2: get_thumbnail

function get_thumbnail($name, $xsize, $ysize)
{
    $thumbname = 'thumbs/' . $name . '_thumb_' . $xsize . '_' . $ysize . '.jpg';
    $fname = 'phpbb/files/' . $name;
    // Ignore the race condition, should only cause unnecessary work to be done at times
    if (!file_exists($thumbname)) {
        // Try to open it up with GD
        $image = @imagecreatefromjpeg($fname);
        if (!$image) {
            $image = @imagecreatefrompng($fname);
        }
        if (!$image) {
            $image = @imagecreatefromgif($fname);
        }
        // If we can't do it then this will have to suffice
        if (!$image) {
            return 'images/screen1.jpg';
        }
        // imagecopyresampled assumes images are at gamma 1.0, while they probably are at 2.2 (sRGB)
        // details and examples: http://www.4p8.com/eric.brasseur/gamma.html
        imagegammacorrect($image, 2.2, 1.0);
        $imageout = imagecreatetruecolor($xsize, $ysize);
        imagecopyresampled($imageout, $image, 0, 0, 0, 0, $xsize, $ysize, imagesx($image), imagesy($image));
        imagegammacorrect($imageout, 1.0, 2.2);
        imagejpeg($imageout, $thumbname);
    }
    return $thumbname;
}
开发者ID:renemilk,项目名称:spring-website,代码行数:28,代码来源:thumbs.php

示例3: gamma

 /**
  * {@inheritdoc}
  */
 public function gamma($correction)
 {
     if (false === imagegammacorrect($this->ressource, 1.0, $correction)) {
         throw new RuntimeException('Gamma correction failed');
     }
     return $this;
 }
开发者ID:anillaogi016,项目名称:zend-admin,代码行数:10,代码来源:Effects.php

示例4: execute

 /**
  * Applies gamma correction to a given image
  *
  * @param  \Intervention\Image\Image $image
  * @return boolean
  */
 public function execute($image)
 {
     $gamma = $this->argument(0)->type('numeric')->required()->value();
     foreach ($image as $frame) {
         imagegammacorrect($frame->getCore(), 1, $gamma);
     }
     return true;
 }
开发者ID:EdgarPost,项目名称:image,代码行数:14,代码来源:GammaCommand.php

示例5: execute

 /**
  * Executes imagegammacorrect()
  *
  * @param WideImage_Image $image
  * @param numeric $input_gamma
  * @param numeric $output_gamma
  * @return WideImage_TrueColorImage
  */
 function execute($image, $input_gamma, $output_gamma)
 {
     $new = $image->copy();
     if (!imagegammacorrect($new->getHandle(), $input_gamma, $output_gamma)) {
         throw new WideImage_GDFunctionResultException("imagegammacorrect() returned false");
     }
     return $new;
 }
开发者ID:yusuffakhruddin,项目名称:Filemanager,代码行数:16,代码来源:CorrectGamma.php

示例6: post_plot

function post_plot($img)
{
    global $tp;
    if (isset($tp['gamma'])) {
        imagegammacorrect($img, 1.0, $tp['gamma']);
    }
    if ($tp['savealpha']) {
        imagesavealpha($img, True);
    }
}
开发者ID:myfarms,项目名称:PHPlot,代码行数:10,代码来源:tc-lines.php

示例7: apply

 public function apply($resource)
 {
     @(list(, $input, $output) = func_get_args());
     $input = (double) $input;
     $output = (double) $output;
     if (!imagegammacorrect($resource, $input, $output)) {
         throw new Exception("Gamma correction failed");
     }
     return $resource;
 }
开发者ID:pyrsmk,项目名称:imagix,代码行数:10,代码来源:Gamma.php

示例8: get_thumbnail

/**
 * Generate a thumbnail of a given file from the phpbb directory
 * 
 * @return string the path of the file, images/screen1.jpg on failure
 */
function get_thumbnail($name, $xsize, $ysize)
{
    $thumbname = 'thumbs/' . $name . '_thumb_' . $xsize . '_' . $ysize . '.jpg';
    $fname = 'phpbb/files/' . $name;
    // check if we can actually read the file
    if (!is_readable($fname)) {
        // we can't continue if we can't read the file
        return 'images/screen1.jpg';
    }
    // Ignore the race condition, should only cause unnecessary work to be done at times
    if (!file_exists($thumbname)) {
        // Try to open it up with GD
        $image = @imagecreatefromjpeg($fname);
        if (!$image) {
            $image = @imagecreatefrompng($fname);
        }
        if (!$image) {
            $image = @imagecreatefromgif($fname);
        }
        // If we can't do it then this will have to suffice
        if (!$image) {
            return 'images/screen1.jpg';
        }
        $srcw = imagesx($image);
        $srch = imagesy($image);
        $clipx = 0;
        $clipy = 0;
        $clipw = $srcw;
        $cliph = $srch;
        if ($xsize < $srcw * 0.5) {
            $maxclip = 0.8;
            $s = max($xsize / $srcw - $maxclip, 0.0) / (1.0 - $maxclip);
            $scale = $maxclip + (1.0 - $maxclip) * $s;
            $clipx = $srcw * (1.0 - $scale) / 2.0;
            $clipw = $srcw - $clipx * 2;
        }
        if ($ysize < $srch * 0.5) {
            $maxclip = 0.8;
            $s = max($ysize / $srch - $maxclip, 0.0) / (1.0 - $maxclip);
            $scale = $maxclip + (1.0 - $maxclip) * $s;
            $clipy = $srch * (1.0 - $scale) / 2.0;
            $cliph = $srch - $clipy * 2;
        }
        // imagecopyresampled assumes images are at gamma 1.0, while they probably are at 2.2 (sRGB)
        // details and examples: http://www.4p8.com/eric.brasseur/gamma.html
        imagegammacorrect($image, 2.2, 1.0);
        $imageout = imagecreatetruecolor($xsize, $ysize);
        imagecopyresampled($imageout, $image, 0, 0, $clipx, $clipy, $xsize, $ysize, $clipw, $cliph);
        imagegammacorrect($imageout, 1.0, 2.2);
        imagejpeg($imageout, $thumbname);
    }
    return $thumbname;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:58,代码来源:thumbs.php

示例9: make_grayscale

 public function make_grayscale()
 {
     // create a copy
     $dest = $this->image;
     unset($this->image);
     $this->load();
     if (is_resource($dest)) {
         // Apply grayscale filter
         imagecopymergegray($dest, $this->image, 0, 0, 0, 0, $this->size['width'], $this->size['height'], 0);
         imagegammacorrect($dest, 1.0, apply_filters('grayscale_gamma_correction', 0.7));
         imagedestroy($this->image);
         $this->image = $dest;
         return true;
     }
 }
开发者ID:jeffhertzler,项目名称:grayscale,代码行数:15,代码来源:class-grayscale-image-editor.php

示例10: mkticket

 public function mkticket($data)
 {
     $this->reload_conf($data['type']);
     $this->img = $this->getimg($GLOBALS['genRoot'] . 'frames/' . $this->conf['img']);
     if (isset($this->conf['gamma'])) {
         imagegammacorrect($this->img, 1.0, $this->conf['gamma']);
     }
     if (isset($data['firstname']) && $data['firstname']) {
         $this->addtext($this->conf['firstname'], $data['firstname']);
     } else {
         $this->addblank($this->conf['firstname']);
     }
     if (isset($data['lastname']) && $data['lastname']) {
         $this->addtext($this->conf['lastname'], $data['lastname']);
     } else {
         $this->addblank($this->conf['lastname']);
     }
     if (isset($data['ticketid'])) {
         $this->addtext($this->conf['ticketid'], $data['ticketid']);
     }
     $this->addtext($this->conf['cb_label'], $data['barcode']);
     checksum($data['barcode']);
     writecode($this->img, $this->conf['codebar'], $data['barcode']);
 }
开发者ID:bontiv,项目名称:intrateb,代码行数:24,代码来源:gen.php

示例11: gamma

    /**
     * Change gamma
     *
     */
    private function gamma() {

        imagegammacorrect($this->im,1,$this->Gamma[1]);

    }
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:9,代码来源:easyphpthumbnail.php

示例12: imagecreate

<?php

$image = imagecreate(150, 150);
$grey = imagecolorallocate($image, 6, 6, 6);
$gray = imagecolorallocate($image, 15, 15, 15);
$half = imagefilledarc($image, 75, 75, 70, 70, 0, 180, $grey, IMG_ARC_PIE);
$half2 = imagefilledarc($image, 75, 75, 70, 70, 0, -180, $gray, IMG_ARC_PIE);
$gamma = imagegammacorrect($image, 1, 5);
if ($gamma) {
    ob_start();
    imagepng($image, null, 9);
    $img = ob_get_contents();
    ob_end_clean();
}
echo md5(base64_encode($img));
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:imagegammacorrect_variation1.php

示例13: gamma

 /**
  * gamma correction
  *
  * @param       float          gamma input
  * @param       float          gamma output
  * @return      ImageWriter
  */
 public function gamma($inputgamma, $outputgamma)
 {
     if (!is_null($this->imageResource)) {
         if (!imagegammacorrect($this->imageResource, (double) $inputgamma, (double) $outputgamma)) {
             throw new ImageWriterException('Gamma correction failed.');
         }
     }
     return $this;
 }
开发者ID:naucon,项目名称:image,代码行数:16,代码来源:ImageWriter.php

示例14: correct_gamma

 public function correct_gamma($input_gamma, $output_gamma)
 {
     imagegammacorrect($this->gd, $input_gamma, $output_gamma);
 }
开发者ID:jaz303,项目名称:base-php,代码行数:4,代码来源:image.php

示例15: ___resize

 /**
  * Resize the image proportionally to the given width/height
  *
  * Note: Some code used in this method is adapted from code found in comments at php.net for the GD functions
  *
  * @param int $targetWidth Target width in pixels, or 0 for proportional to height
  * @param int $targetHeight Target height in pixels, or 0 for proportional to width. Optional-if not specified, 0 is assumed.
  * @return bool True if the resize was successful
  *
  * @todo this method has become too long and needs to be split into smaller dedicated parts 
  *
  */
 public function ___resize($targetWidth, $targetHeight = 0)
 {
     $orientations = null;
     // @horst
     $needRotation = $this->autoRotation !== true ? false : ($this->checkOrientation($orientations) && (!empty($orientations[0]) || !empty($orientations[1])) ? true : false);
     $needResizing = true;
     // $this->isResizeNecessary($targetWidth, $targetHeight);
     //if(!$needResizing && !$needRotation) return true;
     $source = $this->filename;
     $dest = str_replace("." . $this->extension, "_tmp." . $this->extension, $source);
     $image = null;
     switch ($this->imageType) {
         // @teppo
         case IMAGETYPE_GIF:
             $image = @imagecreatefromgif($source);
             break;
         case IMAGETYPE_PNG:
             $image = @imagecreatefrompng($source);
             break;
         case IMAGETYPE_JPEG:
             $image = @imagecreatefromjpeg($source);
             break;
     }
     if (!$image) {
         return false;
     }
     if ($this->imageType != IMAGETYPE_PNG) {
         // @horst: linearize gamma to 1.0 - we do not use gamma correction with png because it doesn't respect transparency
         imagegammacorrect($image, 2.0, 1.0);
     }
     if ($needRotation) {
         // @horst
         $image = $this->imRotate($image, $orientations[0]);
         if ($orientations[0] == 90 || $orientations[0] == 270) {
             // we have to swap width & height now!
             $tmp = array($targetWidth, $targetHeight);
             $targetWidth = $tmp[1];
             $targetHeight = $tmp[0];
             $tmp = array($this->getWidth(), $this->getHeight());
             $this->setImageInfo($tmp[1], $tmp[0]);
         }
         if ($orientations[1] > 0) {
             $image = $this->imFlip($image, $orientations[1] == 2 ? true : false);
         }
     }
     if ($needResizing) {
         list($gdWidth, $gdHeight, $targetWidth, $targetHeight) = $this->getResizeDimensions($targetWidth, $targetHeight);
         $thumb = imagecreatetruecolor($gdWidth, $gdHeight);
         if ($this->imageType == IMAGETYPE_PNG) {
             // @adamkiss PNG transparency
             imagealphablending($thumb, false);
             imagesavealpha($thumb, true);
         } else {
             if ($this->imageType == IMAGETYPE_GIF) {
                 // @mrx GIF transparency
                 $transparentIndex = ImageColorTransparent($image);
                 $transparentColor = $transparentIndex != -1 ? ImageColorsForIndex($image, $transparentIndex) : 0;
                 if (!empty($transparentColor)) {
                     $transparentNew = ImageColorAllocate($thumb, $transparentColor['red'], $transparentColor['green'], $transparentColor['blue']);
                     $transparentNewIndex = ImageColorTransparent($thumb, $transparentNew);
                     ImageFill($thumb, 0, 0, $transparentNewIndex);
                 }
             } else {
                 $bgcolor = imagecolorallocate($thumb, 0, 0, 0);
                 imagefilledrectangle($thumb, 0, 0, $gdWidth, $gdHeight, $bgcolor);
                 imagealphablending($thumb, false);
             }
         }
         imagecopyresampled($thumb, $image, 0, 0, 0, 0, $gdWidth, $gdHeight, $this->image['width'], $this->image['height']);
         $thumb2 = imagecreatetruecolor($targetWidth, $targetHeight);
         if ($this->imageType == IMAGETYPE_PNG) {
             // @adamkiss PNG transparency
             imagealphablending($thumb2, false);
             imagesavealpha($thumb2, true);
         } else {
             if ($this->imageType == IMAGETYPE_GIF) {
                 // @mrx GIF transparency
                 if (!empty($transparentColor)) {
                     $transparentNew = ImageColorAllocate($thumb2, $transparentColor['red'], $transparentColor['green'], $transparentColor['blue']);
                     $transparentNewIndex = ImageColorTransparent($thumb2, $transparentNew);
                     ImageFill($thumb2, 0, 0, $transparentNewIndex);
                 }
             } else {
                 $bgcolor = imagecolorallocate($thumb2, 0, 0, 0);
                 imagefilledrectangle($thumb2, 0, 0, $targetWidth, $targetHeight, 0);
                 imagealphablending($thumb2, false);
             }
         }
//.........这里部分代码省略.........
开发者ID:gusdecool,项目名称:bunga-wire,代码行数:101,代码来源:ImageSizer.php


注:本文中的imagegammacorrect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。