• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imagegammacorrect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: tweak_wm_preview_images

function tweak_wm_preview_images($ref, $rotateangle, $gamma, $extension = "jpg")
{
    $ps = sql_query("select * from preview_size where (internal=1 or allow_preview=1)");
    for ($n = 0; $n < count($ps); $n++) {
        $wm_file = get_resource_path($ref, true, $ps[$n]["id"], false, $extension, -1, 1, true);
        if (!file_exists($wm_file)) {
            return false;
        }
        list($sw, $sh) = @getimagesize($wm_file);
        $wm_source = imagecreatefromjpeg($wm_file);
        # Apply tweaks
        if ($rotateangle != 0) {
            # Use built-in function if available, else use function in this file
            if (function_exists("imagerotate")) {
                $wm_source = imagerotate($wm_source, $rotateangle, 0);
            } else {
                $wm_source = AltImageRotate($wm_source, $rotateangle);
            }
        }
        if ($gamma != 0) {
            imagegammacorrect($wm_source, 1.0, $gamma);
        }
        imagejpeg($wm_source, $wm_file, 95);
        list($tw, $th) = @getimagesize($wm_file);
        if ($rotateangle != 0) {
            $temp = $sw;
            $sw = $sh;
            $sh = $temp;
        }
        # Rescale image
        $wm_target = imagecreatetruecolor($sw, $sh);
        imagecopyresampled($wm_target, $wm_source, 0, 0, 0, 0, $sw, $sh, $tw, $th);
        imagejpeg($wm_target, $wm_file, 95);
    }
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:35,代码来源:image_processing.php


示例17: 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();
     return imagegammacorrect($image->getCore(), 1, $gamma);
 }
开发者ID:hilmysyarif,项目名称:sic,代码行数:11,代码来源:GammaCommand.php


示例18: gamma

 /**
  * Applies gamma correction
  *
  * @param  float $input
  * @param  float $output
  * @return Image
  */
 public function gamma($input, $output)
 {
     imagegammacorrect($this->resource, $input, $output);
     return $this;
 }
开发者ID:bytebybyte,项目名称:laravel-ecommerce,代码行数:12,代码来源:Image.php


示例19: washed

 public function washed()
 {
     imagefilter($this->image, IMG_FILTER_BRIGHTNESS, 30);
     imagefilter($this->image, IMG_FILTER_NEGATE);
     imagefilter($this->image, IMG_FILTER_COLORIZE, -50, 0, 20, 50);
     imagefilter($this->image, IMG_FILTER_NEGATE);
     imagefilter($this->image, IMG_FILTER_BRIGHTNESS, 10);
     imagegammacorrect($this->image, 1, 1.2);
     return $this;
 }
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:10,代码来源:Filter.php


示例20: effect

 public function effect($resource)
 {
     imagegammacorrect($resource, 1, 1.2);
     imagefilter($resource, IMG_FILTER_CONTRAST, -1);
     imagefilter($resource, IMG_FILTER_COLORIZE, 60, 20, 0, 50);
 }
开发者ID:demouth,项目名称:dmimage,代码行数:6,代码来源:InstagramWalden.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imagegd函数代码示例发布时间:2022-05-15
下一篇:
PHP imagefttext函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap