日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php imagick手册,PHP中使用Imagick实现各种图片效果实例

發布時間:2024/8/23 php 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php imagick手册,PHP中使用Imagick实现各种图片效果实例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這篇文章主要介紹了PHP中使用Imagick實現各種圖片效果實例,本文講解了偏置圖像、改變圖片大

imagick是一個功能強大的圖像處理庫。

說是翻譯 其實就是簡要介紹imagick 的主要功能的或者說是我覺得比較實用的功能函數的介紹 以及使用的例子。

因為本人的英語水平有限,所以采用比較通俗或者說比較貼近應用化的語言來描述。

先欣賞一組炫麗的效果:

偏置圖像:

例子:

復制代碼 代碼如下:

ini_set('display_errors',1);

header('Content-type: image/jpeg');

$image = new Imagick('1.jpg');

$image->rollImage(20,39);

echo $image;

?>

thumbnailImage($width,$height) 改變圖片大小

例子:

復制代碼 代碼如下:

ini_set('display_errors',1);

header('Content-type: image/jpeg');

$image = new Imagick('1.jpg');

$image->thumbnailImage(100,0);

echo $image;

?>

addNoiseImage(int $noise_type [, int $channel= Imagick::CHANNEL_ALL ]);

功能:

Adds random noise to the image

添加干擾素

復制代碼 代碼如下:

Noise constants ( $noise_type 類型)

imagick::NOISE_UNIFORM (integer)

imagick::NOISE_GAUSSIAN (integer)

imagick::NOISE_MULTIPLICATIVEGAUSSIAN (integer)

imagick::NOISE_IMPULSE (integer)

imagick::NOISE_LAPLACIAN (integer)

imagick::NOISE_POISSON (integer)

Channel constants ( $channel 類型)

imagick::CHANNEL_UNDEFINED (integer)

imagick::CHANNEL_RED (integer)

imagick::CHANNEL_GRAY (integer)

imagick::CHANNEL_CYAN (integer)

imagick::CHANNEL_GREEN (integer)

imagick::CHANNEL_MAGENTA (integer)

imagick::CHANNEL_BLUE (integer)

imagick::CHANNEL_YELLOW (integer)

imagick::CHANNEL_ALPHA (integer)

imagick::CHANNEL_OPACITY (integer)

imagick::CHANNEL_MATTE (integer)

imagick::CHANNEL_BLACK (integer)

imagick::CHANNEL_INDEX (integer)

imagick::CHANNEL_ALL (integer)

例子:

復制代碼 代碼如下:

ini_set('display_errors',1);

header('Content-type: image/jpeg');

$image = new Imagick('1.jpg');

$image->thumbnailImage(100,0);

$image->addNoiseImage(imagick::NOISE_POISSON,imagick::CHANNEL_OPACITY);

echo $image;

?>

annotateImage 創建文本圖像

例子:

復制代碼 代碼如下:

$image = new Imagick();

$draw = new ImagickDraw();

$pixel = new ImagickPixel( 'gray' );

$image->newImage(800, 75, $pixel);

$pixel->setColor('black');

$draw->setFont('Bookman-DemiItalic');

$draw->setFontSize( 30 );

$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');

$image->setImageFormat('png');

header('Content-type: image/png');

echo $image;

?>

blurImage(float $radius , float $sigma [, int $channel ])

Adds blur filter to image 圖像模糊度處理

參數:

復制代碼 代碼如下:

int $channel :

imagick::CHANNEL_UNDEFINED (integer)

imagick::CHANNEL_RED (integer)

imagick::CHANNEL_GRAY (integer)

imagick::CHANNEL_CYAN (integer)

imagick::CHANNEL_GREEN (integer)

imagick::CHANNEL_MAGENTA (integer)

imagick::CHANNEL_BLUE (integer)

imagick::CHANNEL_YELLOW (integer)

imagick::CHANNEL_ALPHA (integer)

imagick::CHANNEL_OPACITY (integer)

imagick::CHANNEL_MATTE (integer)

imagick::CHANNEL_BLACK (integer)

imagick::CHANNEL_INDEX (integer)

imagick::CHANNEL_ALL (integer)

復制代碼 代碼如下:

ini_set('display_errors',1);

header('Content-type: image/jpeg');

$image = new Imagick('1.jpg');

$image->blurImage(5,3);

echo $image;

?>

borderImage ( mixed $bordercolor , int $width , int $height ) 圖片邊框處理

例子:

復制代碼 代碼如下:

ini_set('display_errors',1);

header('Content-type: image/jpeg');

$image = new Imagick('1.jpg');

$color=new ImagickPixel();

$color->setColor("rgb(220,220,220)");

$image->borderImage($color,5,4);

$image->blurImage(5,5,imagick::CHANNEL_GREEN);

echo $image;

?>

charcoalImage ( float $radius , float $sigma ) 圖像素描處理

參數說明:

$radius :越小越薄。

$sigma: 越大 墨越深 反之。

例子:

復制代碼 代碼如下:

本文原創發布php中文網,轉載請注明出處,感謝您的尊重!

總結

以上是生活随笔為你收集整理的php imagick手册,PHP中使用Imagick实现各种图片效果实例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。