imagick

imagemagick, imagick和magickwand的安装

China☆狼群 提交于 2019-11-30 08:24:33
imagemagick是一个开源的强大的适用于图形图像开发制作的软件套件,与GD库同等级别的,甚至有些功能是GD所没有的,比如创建动态的gif图 片。它基于命令行操作的,但同时为大量的其它编程语言提供了接口。详细请访问官方网站是http://www.imagemagick.org 本文主要介绍imagemagick为php语言提供的两个扩展imagick和MagickWand for PHP的安装。IMagick 已经被php最新的版本选为内部的扩展函数库,php的手册已经有了函数说明使用文档。这个扩展是可选安装的。 imagemagick有两款接口,分别是 MagickWand API 和MagickCore API。MagickCore API 是全面的底层的接口,比较适合高水平的程序员,而MagickWand API 是官方推荐的精选的重要的一些接口。IMagick和MagickWand for PHP就是分别为这两款接口而准备的。 下载地址 : ImageMagick 6.3.6-10 http://sourceforge.net/projects/ImageMagick IMagick http://pecl.php.net/package/imagick MagickWand For PHP http://www.magickwand.org/ 安装 :

How to install ImageMagick on Windows 7 (2)

自闭症网瘾萝莉.ら 提交于 2019-11-30 07:38:31
Hopefully, despite similar question titles, this isn't a duplicate issue. I've installed ImageMagick-6.7.5-6-Q16-windows-dll.exe . I have php_imagick_dyn-Q16.dll renamed to php_imagick.dll in PHP's ext directory. I have extension=php_imagick.dll in my php.ini . I try to run a basic test: php -r "var_dump(class_exists('Imagick'));" . I get this error: PHP Startup: imagick: Unable to initialise module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options must match. CLI has stopped working. Windows can check online for a solution to the problem. > Check

Imagick php windows

风流意气都作罢 提交于 2019-11-30 07:30:11
I am trying to use iMagick in Symfony2. I am using PHP 5.4.16 and all i have done : 1-Copy php_imagick_nts.dll from php5-4 directory from the extracted http://valokuva.org/~mikko/imagick-php54-php53.tgz to php/ext . 2-Rename it to php_imagick.dll and add the “extension=php_imagick.dll” to php.ini 3-Create a page like this : <?php $a = new Imagick(); ?> but i receive this : Fatal error: Class ‘Imagick’ not found in C:\xampp\htdocs\info.php When I tried to use this in a symfony controller, the error occur again: FatalErrorException: Error: Class 'Imagick' not found Unfortunately the details

set density parameter for imagick with php

无人久伴 提交于 2019-11-30 05:41:10
问题 I want to convert a pdf page to a png image with Imagick. I tried with PHP, but the image quality was very low. When I tried with command line, the result was perfect. PHP code $im = new imagick( __DIR__ . DIRECTORY_SEPARATOR.$PDFName.'['.$i.']' ); $params = $im->identifyImage(); $width = $params['geometry']['width']*1; $height = $params['geometry']['height']*1; $im->setResolution(400,400); $im->resizeImage($width ,$height, imagick::FILTER_SINC, 1, true); $im->writeImage(__DIR__ . DIRECTORY

How to set the trimming color in Imagick?

萝らか妹 提交于 2019-11-30 05:21:24
问题 I am trying to remove transparent areas of an image with php using imagick. Image Magick provides the trim method: Imagick::trimImage Remove edges that are the background color from the image. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer. How do I set the color which Imagick may trim? The following script sets the background color to grey. However trim removes the blue background color as you can see below. $im = new Imagick( "1.png" ); //

how to resize an SVG with Imagick/ImageMagick

你离开我真会死。 提交于 2019-11-30 05:04:39
I am sending a string representation of an SVG file to the server and using Imagick to turn this into a jpeg in the following manner: $image = stripslashes($_POST['json']); $filename = $_POST['filename']; $unique = time(); $im = new Imagick(); $im->readImageBlob($image); $im->setImageFormat("jpeg"); $im->writeImage('../photos/' . $type . '/humourised_' . $unique . $filename); $im->clear(); $im->destroy(); However I wish to resize the SVG prior to rasterizing it so the the resulting image is larger than the dimensions specified within the SVG file. I modified my code to the following: $image =

Trying to get imagick running on PHP 5.4.3 at Windows x64

走远了吗. 提交于 2019-11-30 05:01:34
问题 I have Windows 7 64 bits, PHP 5.4.3 installed through WAMP 2.2 and imagick ( ImageMagick-6.8.3-9-Q16-x64-dll.exe ). I tried to use the php's dll of imagick from a lot of sources but all of them give this error in apache_error.log: PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_imagick.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0 Any thoughts on how to solve this? 回答1: perhaps this can help you: step-by-step instructions for

Black background when converting multi page PDF to JPG with Imagick php extension

大憨熊 提交于 2019-11-30 04:47:05
问题 What is the best way to correct black background when converting multi page PDF to JPG with Imagick php extension? Following is the code used on my application: $imagick = new Imagick($file); $imagick->setResolution(150,150); $imagick->setImageFormat("jpg"); $imagick->setImageCompression(imagick::COMPRESSION_JPEG); $imagick->setImageCompressionQuality(70); foreach ($imagick as $c => $_page) { $_page->setImageBackgroundColor('white'); $_page->adaptiveResizeImage($maxsize,$maxsize,true); $_page

how do i use imagick in php? (resize & crop)

别说谁变了你拦得住时间么 提交于 2019-11-30 02:06:31
I use imagick for thumbnail crop, but sometimes cropped thumbnails are missing top part of the images (hair, eyes). I was thinking to resize the image then crop it. Also, I need to keep the image size ratio. Below is the php script I use for crop: $im = new imagick( "img/20130815233205-8.jpg" ); $im->cropThumbnailImage( 80, 80 ); $im->writeImage( "thumb/th_80x80_test.jpg" ); echo '<img src="thumb/th_80x80_test.jpg">'; Thanks.. This task is not easy as the "important" part may not always be at the same place. Still, using something like this $im = new imagick("c:\\temp\\523764_169105429888246

PDF to JPG conversion using PHP

爱⌒轻易说出口 提交于 2019-11-30 00:42:33
I'm trying to convert PDF to IMG (JPG) with help PHP. I'm using imagick extension. this is my code $fp_pdf = fopen($pdf, 'rb'); $img = new imagick(); // [0] can be used to set page number $img->readImageFile($fp_pdf); $img->setImageFormat( "jpg" ); $img->setImageCompression(imagick::COMPRESSION_JPEG); $img->setImageCompressionQuality(90); $img->setResolution(300,300); $img->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH); $data = $img->getImageBlob(); my source pdf file has right dimension (210x297 mm, like A4 has). And everything looks good. But my jpg has page dimension as 842x595 px, and