imagick

Count pages in PDF file using Imagemagick - PHP

那年仲夏 提交于 2019-12-05 08:06:38
I am using PHP 5 with Apache in my Windows Vista PC . I have Imagemagick already installed and configured. I want to count the total number of pages in a pdf file using imagick . I fount one solution here , but dont know how to open pdf file as text and count pages. somebody give me a clear solution to count pages using imagemagick like identify -format %n testfile.pdf From googling, I found some workarounds or examples; imagick(identify -format %n testfile.pdf) identify -density 12 -format "%p" testfile.pdf identify -format %n testfile.pdf I don't know how to make use of this stuff.. Instead

How to use imagick's writeImage() function?

依然范特西╮ 提交于 2019-12-05 05:11:43
This works if I keep the script in the same directory as the image being manipulated. And the resultant image "foo.jpg" is also generated in the same location. <?php $im = new imagick('image.jpg'); $im->thumbnailImage( 200, 0); $im->writeImage("foo.jpg"); ?> But what if the script is in one location and the image I wish to work with is in another and the location I wish to save the thumbnail to is somewhere else, how to specify these paths? Doing something like this doesn't work: $im = new imagick('path/to/image.jpg'); Might be some file system problem. Try and get a file pointer in php first

Laravel 5.2: Class Imagick not found

こ雲淡風輕ζ 提交于 2019-12-05 03:54:42
We are converting PDF pages to multiple single images. We found a code snippet in stackoverflow and converted it to a service class. We have Imagick installed and it shows up in phpinfo() as well. However, in our laravel application, version 5.2, we are getting following error. ReflectionException in Container.php line 798: Class Imagick does not exist We tested our code outside laravel environment and it's working like a charm. No such error is thrown. We also ran following command to check Imagick php -i | grep -i imagick and this is the output /etc/php5/cli/conf.d/20-imagick.ini, imagick

Outline a transparent image using imagick PHP

我的未来我决定 提交于 2019-12-05 02:49:36
I have an image with a transparent background that I'd like to outline with a 5px border. In photoshop, I can stroke it to achieve this. I've tried using borderImage but it won't outline the penguin. $image = new Imagick(); $image->readImage('tux.png'); $image->borderImage(new ImagickPixel('red'), 5, 5); // no outline This is the image. This is what I want to achieve. I'll start at the command line and may do the PHP later, or let you work that bit out... Step 1 - Extract transparency As you have seen, -border outlines the whole image, but you actually want to outline the opaque areas only so

PHP ImagickDraw with outlined text issues

夙愿已清 提交于 2019-12-05 02:48:29
问题 I'm learning and practicing my Imagick skills. I have issues with outlined text using Imagick stroke. I would like to achieve an effect visible on this image: a popular Internet meme: Here's the code I have so far: $draw = new \ImagickDraw(); $outputImage = new \Imagick('meme.jpg'); $draw->setFillColor('#fff'); $draw->setFont('impact.ttf'); $draw->setFontSize(40); $draw->setGravity(\Imagick::GRAVITY_NORTH); $draw->setStrokeColor('#000'); $draw->setStrokeWidth(1); $draw->setStrokeAntialias

PHP imagick detect transparency

人走茶凉 提交于 2019-12-05 01:33:52
I want to be able to detect whether an image is transparent or not using the Imagick PHP extension. So far, the only luck I've been having is to run the exec() / some other command, and use the ImageMagick command line tool to achieve this. Here's what I mean: exec("identify -verbose example_transparent_image.png | grep \"Alpha\"", $output); $is_transparent = !empty($output) ? true : false; The logic is simple. Do a verbose check on the image in question: if the output contains any alpha information, that means it uses transparency. It seems that the PHP imagick extension should have this as

Imagick PHP Extension — Montage help?

泄露秘密 提交于 2019-12-05 00:50:34
问题 I've been having some trouble generating an image with the Imagick PHP extension. Everything works fine, except my following "montage" has a white background and therefore I cannot overlay it on top of something else. How can I generate a montage with a transparent background? $Montage = $Icons->montageImage(new imagickdraw(), "3x2+0+0", "34x34+3+3", imagick::MONTAGEMODE_UNFRAME, "0x0+0+0"); $Canvas->compositeImage($Montage, $Montage->getImageCompose(), 5, 5); Thanks!! 回答1: I had the same

Windows php5.6配置imagick 基于Apache/IIS

好久不见. 提交于 2019-12-05 00:20:29
安装Imagick确实是很恼火的事情,网上的讨论一大堆,中文英文都有,我也在这里卡了很久,这次基本上算是弄明白了,记录一下。 Imagick有点像MySQL的安装方式一样,首先服务器需要安装MySQL Server,然后php需要安装mysql扩展,通过扩展提供的api(诸如mysql_connect这些方法)去调用执行mysql。 1. 我的环境 Win7 + Apache2.4 + php5.6.28 WinServer 2012 + IIS8.5 + php5.6.28 2. 先要去官方下载最新版Imagick https://www.imagemagick.org/ 1. 虽然官方建议首选x64,不过我还是选的x86,因为我的php用的是x86(php, Imagick版本一致总不会出错,虽然我的windows系统是64位)。 2. Q8和Q16的区别官方写得很清楚了,因此我最终选择的是 ImageMagick-7.0.4-0-Q16-x86-dll.exe 3. 紧接着是安装,选择将Imagick加入环境变量,接着下一步直至完成。 这一步很重要! 4. 安装完成的目录为C:\ImageMagick-6.9.7-Q16\ 当然这只是为了便于后面的说明,实际情况可以安装在任何目录下 3. 去官方下载php的Imagick扩展 https://pecl.php.net

Error in using readImage function (Imagick)

自古美人都是妖i 提交于 2019-12-04 21:43:42
I have this function to change Image DPI using Imagick extension: <?php // create an image copy $image=new Imagick("D:/xampp/htdocs/extra/1270006212-Z3BFN9J.jpg"); $image->readImage("D:/xampp/htdocs/extra/1270006212-Z3BFN9J.jpg"); $image->setImageFileName("D:/xampp/htdocs/extra/ANC.jpg"); $image->writeImage(); ?> Whenever program reached in readImage function, browser stops running and give me error: The connection was reset The connection to the server was reset while the page was loading. The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to

PHP扩展插件imagick使用笔记

江枫思渺然 提交于 2019-12-04 15:56:43
PHP扩展插件ImageMagick使用笔记 imagick是一个PHP的扩展,用ImageMagick提供的API来进行图片的创建与修改,不过这些操作已经包装到扩展imagick中去了,最终调用的是ImageMagick提供的API ImageMagick是一套软件系列,主要用于图片的创建、编辑以及转换等,详细的解释见ImageMagick的官方网站http://www.imagemagick.org/,ImageMagick与GD的性能要高很多,如果是在处理大量的图片时更加能体现ImageMagick的性能。 1 先安装ImageMagick客户端 <pre> wget http://www.imagemagick.org/download/ImageMagick-6.9.7-5.zip unzip ImageMagick-6.9.7-5.zip cd ImageMagick-6.9.7-5 ./configure --prefix=/opt/ImageMagick --enable-share --enable-static LDFLAGS="-L/usr/lib64" CPPFLAGS="-I/usr/include" make make install ldconfig /usr/local/lib #下面代码运行之后会多出个png 原来的jpg还是保留的 /opt