imagemagick介绍:

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) including DPXEXR, GIF, JPEG, JPEG-2000, PDF, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite language. Choose from these interfaces: G2F (Ada), MagickCore (C), MagickWand (C), ChMagick (Ch), ImageMagickObject (COM+), Magick++ (C++),JMagick (Java), L-Magick (Lisp), LuaNMagick (Neko/haXe), Magick.NET (.NET), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP(PHP), IMagick (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick (Tcl/TK). With a language interface, use ImageMagick to modify or create images dynamically and automagically.

ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license, approved by the OSI and recommended for use by the OSSCC.

The ImageMagick development process ensures a stable API and ABI. Before each ImageMagick release, we perform a comprehensive security assessment that includes memory error and thread data race detection to prevent security vulnerabilities.

The current release is ImageMagick 6.9.0-3 available from http://www.imagemagick.org/download. It runs on LinuxWindowsMac Os XiOS, Android OS, and others.

The authoritative ImageMagick web site is http://www.imagemagick.org.

著名的图片服务提供商 Flickr 使用的是ImageMagick,还有 Yupoo 、 手机之家 使用的也是ImageMagick。

下载:http://www.imagemagick.org/download/

windows安装:

下载windows版:

安装后,在安装php扩展:官方推荐的3个:

MagickWand for PHP a native PHP-extension to the ImageMagick MagickWand API.

IMagick is a native PHP extension to create and modify images using the ImageMagick API. Documentation for the extension is available here.

phMagick is a wrapper class for ImageMagick, wrapping the most common web image manipulation actions in easy to use functions, but allowing full access to ImageMagick's power by issuing system calls to it's command-line programs.

决定使用Imagick。

windows下在iMagick的dll扩展 http://pecl.php.net/package/imagick

重命名为php_imagick.dll 然后copy到php的ext文件夹下
   在php.ini文件中添加设置
   extension=php_imagick.dll
   之后查看phpinfo() 里面有没有imagick一栏,如果有的话就可以进行测试了。

php5.4.x or php5.5.x

dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit.

以上标识,同你下载的ImageMagick下载标识相同,本人用的是q16 。安装路径不要有空格。

5. 把dll文件重命名为php_imagick.dll,并放到php 扩展文件目录 php/ext 中。

6. 在 php.ini 配置文件中添加,extension=php_imagick.dll。

7. 重启电脑,只重启apache不管用的情况下,重启下PC。因为扩展底层使用的是imageMagic软件,所以软件重启电脑,重新加载软件,并刷新path路径。

我总是报错:

“  系统错误 ,无法启动此程序因为计算机丢失CORE_RL_wand_.dll ”

把下载php_imagick-3.4.3-5.5-ts-vc11-x86下面的所有dll放在windows system32下面还是不行,最后看了一篇博客,

(解决了,把扩展包中的“CORE_*.dll” 这些dll文件 放到 你的php.exe同级目录下。

如果没有Imagick 项,请 使用 php扩展调试命令  来检查扩展中存在的问题, 并确保三方软件版本一致即可。

php扩展  调试命令:

在cmd运行:  php --ri imagick

1. 如果报错是:“php_imagick.dll' - %1 不是有效的 Win32 应用程序” ,则说明版本不相符合。 需要检查   imagick软件本身( 如x86)、php本身( x86 ts (thread safe) )、php扩展php_imagick.dll (ts) 三方版本 要一致。

2. 如果报错是:“php.exe - 系统错误 ,无法启动此程序因为计算机丢失CORE_RL_wand_.dll ” , 说明你没有将 php_imagick-3.3.0-5.4-ts-vc9-x86.zip 扩展包中的“CORE_*.dll” 这些dll文件 放到 你的php.exe同级目录下。   ,只需要拷贝 CORE_*.dll 到php目录就可以解决了。

3. 如果php --ri imagick 显示的结果  ImageMagick number of supported formats:  => 0 支持的图片格式数量为0,请看第5步需要新建一个环境变量。

4.如果php代码执行调用时报错:“ NoDecodeDelegateForThisImageFormat ”,表明你的php_imagick.dll的版本 并不支持或并不匹配 ImageMagick软件版本,这时候 php --ri imagick 的结果也显示为: ImageMagick number of supported formats => 0 。需要更换ImageMagick软件版本。

http://www.cnblogs.com/wangqishu/p/5609950.html

参考:http://blog.sina.com.cn/s/blog_966e43000101bgqj.html

LInux安装:

下载源代码:

参考官方教程:

$ cd ImageMagick-6.9.0

$ ./configure

$ make

make install

执行:/usr/local/imagemagick/bin/convert logo: logo.gif 测试一下ImageMagick是否可以正常运行。

(源码安装我有点问题,sudo apt-get install imagemagick

安装完后

/usr/bin下有工具软件

convert -version 能正常输出。

我用这种方式,后面安装php imagick出现问题:

checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.

在网上搜了说要装:

apt-get install libmagickwand-dev libmagickcore-dev

apt-get install libmagickwand-dev libmagickcore-dev
安装后果然没有问题了,结果:

Installing shared extensions: /opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/
Installing header files: /opt/lampp/include/php/

 

或者:convert -version

2、安装PHP扩展:imagick

最新的包可以在下面的地址中找到http://pecl.php.net/package/imagick

1
2
3
4
5
6
7
8
9
10
11
12
wget http://pecl.php.net/get/imagick-3.0.1.tgz
tar zxvf imagick-3.0.1.tgz
cd imagick-3.0.1/
export PKG_CONFIG_PATH=/usr/local/imagemagick/lib/pkgconfig
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
make && make install

/usr/local/php_fcgi/bin/phpize
./configure --with-php-config=/usr/local/php_fcgi/bin/php-config --with-imagick=/usr/local/imagemagick
make && make install
cd ../

编辑/usr/local/php/etc/php.ini 添加:extension = "imagick.so"

编辑/usr/local/php_fcgi/etc/php.ini 添加:extension = "imagick.so"

重启php-fpm或apache。

lu-restart

先试试,再执行:ldconfig ,重新加载一些链接库。

(我用的是pecl install imagick 安装,安装完后提示:

You should add "extension=imagick.so" to php.ini

增加就行了。)

php_imagick程序示例

1.创建一个缩略图并显示出来
<?php
    header('Content-type: image/jpeg');
    $image = new Imagick('image.jpg');
    // If 0 is provided as a width or height parameter,// aspect ratio is maintained
    $image->thumbnailImage(100, 0);
    echo $image;
?>

2.创建一个目录下的缩略图,并保存
<?php
    $images = new Imagick(glob('images
    $im = new Imagick("example.gif");
    
    foreach ($im as $frame) {
    
    $frame->thumbnailImage(50, 50);
    
    $frame->setImagePage(50, 50, 0, 0);
    }
    $im->writeImages("example_small.gif", true);
?>

http://blog.sina.com.cn/s/blog_8da982ac010171iz.html

http://blog.csdn.net/andy1219111/article/details/38335987

http://blog.csdn.net/czloveyeer/article/details/8179766

http://blog.lizhigang.net/archives/228

文档:

http://php.net/manual/zh/book.imagick.php

http://www.bitscn.com/pdb/php/201407/235972.html

http://wenku.baidu.com/view/7b83e46f67ec102de3bd893f.html

php imagemagick库安装使用的更多相关文章

  1. 转:ImageMagick +Jmagick安装

    原文来自于: 目录 一.ImageMagick介绍 二.安装支持库 三.在Linux上用源码编译安装ImageMagick与Jmagick 四.在Linux上使用yum安装ImageMagick与Jm ...

  2. 图片处理服务 ImageMagick 的安装和使用

    简介 该文章使用目前官方最新版本7.0.8,这里只记录下Windows系统下的安装. 官方网站:http://www.imagemagick.org/script/index.php. ImageMa ...

  3. protocol buffer c++ python库安装

    c++库安装较简单,不要用源码,还得下载依赖,就被墙了 https://github.com/google/protobuf/releases  下载一个最新的release安装 #protoc -- ...

  4. [转]Snappy压缩库安装和使用之一

    Snappy压缩库安装和使用之一 原文地址:http://blog.csdn.net/luo6620378xu/article/details/8521223 近日需要在毕业设计中引入一个压缩库,要求 ...

  5. phpize 扩展GD库 安装 ! 环境--centos 7 +nginx 1.7.11+php 5.6.7

    使用phpize编译GD库安装,先安装前置库libjpeg libpng zlib  freetype等 都是下面php编译的几个选项 先看php编译的选项: --with-gd=DIR       ...

  6. DCMTK3.6.1(MD支持库)安装说明

    转载:http://qimo601.iteye.com/blog/1685135 [前言] 最近,因为需要开发DICOM网管模块,必须使用DCMTK的DcmNet模块.但是DCMTK3.6.0在Dcm ...

  7. laravel项目拉取下来安装,node.js库安装

    1.拉取项目 2.切换分支 圈圈里面是版本 composer 安装laravel组件其他库 安装node.js安装包  npm set registry=https://registry.npm.ta ...

  8. python 库安装笔记

    python 库安装笔记 zoerywzhou@163.com http://www.cnblogs.com/swje/ 作者:Zhouwan 2017-2-22 友情提示 安装python库的过程中 ...

  9. python库安装(numpy+scipy+matplotlib+scikit_learn)

    python安装好后,库安装走了很多弯路,查了很多资料,终于安装成功,并且保存了该文章的地址,分享给大家 本人电脑windows 7,64位系统,安装的Python是3.5的,因此下载的库也是对应版本 ...

随机推荐

  1. HDU 1075 What Are You Talking About (Trie)

    What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K ...

  2. 怎样用Google APIs和Google的应用系统进行集成(5)----怎样把Google Tasks的JSON Schema转换成XML的Schema(XSD)?

    前面说了一些Google API的介绍,可是在实际的开发其中,我们可能须要把Google RESTful API返回的JSON数据转换成XML数据输入到第三方系统,这在企业应用集成里面很的常见. 那么 ...

  3. zookeeper安装与集群搭建

    此处以centos系统下zookeeper安装为例,详细步骤可参考官网文档:zookeeper教程 一.单节点部署 1.下载zookeeper wget http://mirrors.hust.edu ...

  4. 【Mac + Android】之Android Studio 环境搭建,AVD模拟器运行(包括:命令行运行AVD,并且Genymotion模拟器插件配置运行)

    目录: 前提.Mac环境下手动配置Android SDK 一. Android Studio下载及配置 二.AVD模拟器配置运行 扩展:命令行运行AVD模拟器 三.在Android Studio 中配 ...

  5. Splash 笔记

    javascript rendering service a lightweight web browser can execute custom JavaScript in page context ...

  6. HTML5课程

    1.新语义化标签:section.header.footer.nav.article.aside.figure.dialog.time.meter.mark.progress.video 2.最新的属 ...

  7. python学习之路----输出所有大小写字母

    print([chr(i) for i in range(48, 58)]) # 所有数字print([chr(i) for i in range(65, 91)]) # 所有大写字母print([c ...

  8. MySQL数据库中的存储引擎

    1.认识存储引擎 存储引擎指定了表的类型,即如何存储和索引数据.是否支持事务等,同时存储引擎也决定了表在计算中的存储方式. 存储引擎是以插件的形式被MySQL软件引入的,所以可以根据应用.实际的领域来 ...

  9. 开源的Eclipse的文件转码插件,可以在不影响中文的情况下改变项目文件编

    http://www.blogjava.net/lifesting/archive/2008/04/11/192250.html, 感谢此作者! 问题描述: 我们项目开发都统一采用utf-8格式编码, ...

  10. ios中沙盒

    打开模拟器沙盒目录 下面看看模拟器的沙盒文件夹在mac电脑上的什么位置. 文件都在个人用户名文件夹下的一个隐藏文件夹里,中文叫资源库,他的目录其实是Library. 2.1 方法1.可以设置显示隐藏文 ...