imagick

How can I scale up an SVG and save as PNG, with PHP without losing quality?

自作多情 提交于 2019-12-08 14:36:23
I have a batch of SVG images that I need to resize and then save as PNG, and I'd like to use PHP to do it. Similar questions to mine have been asked but none of the solutions work for me. For example: option A : use PHP to change the width and height attribute of the SVG. problem with A : this seems to work fine but in fact it only increases the canvas size, not the contents of the canvas. I'm not sure if it's important but my SVGs are small graphics that were created with Illustrator, mostly made up of path elements. option B : use imagick to resize and resave example : $im = new Imagick();

PHP Imagick: Write Image directly to Amazon S3?

柔情痞子 提交于 2019-12-08 06:24:20
问题 Is it possible for me to use the writeImage function in Imagick to write an image directly to an S3 bucket? If so, how? I'm pretty new to the Amazon S3 SDK, so some help would be appreciated. 回答1: With writeImage, probably not (it takes a file path as argument, thus writing the file to the filesystem), but you can getImageBlob to get the image as binary string which you can then easily write to S3 with certain name. It would be easiest for you to use an S3 PHP library, there is one official

GD/imagick code to find if an image is well-focussed or not?

不想你离开。 提交于 2019-12-08 06:01:11
问题 I run a website with thousands of user-contributed photos on it. What I'd like is a script to help me weed out poor photos from good photos. Obviously this isn't 100% possible, but it should be possible to determine if an image has no discernable focussed area? I think? I did a bit of googling and couldn't find much on the subject. I've written a very simple script that iterates over the pixels, and sums the difference in brightness between neighbouring pixels. This gives a high value for

PHP Imagick - setTextEncoding() function doesn't work

痞子三分冷 提交于 2019-12-08 01:52:36
问题 I'm trying to add some text on a Imagick object. However I use setTextEncoding() function, it still doesn't work. ....... $draw = new ImagickDraw(); $draw->setTextEncoding('utf-8'); $draw->setFont($fpath.'/process/ARIAL.TTF'); $draw->setFontSize(80); $draw->setFillColor("#ffffff"); /*** annotate the text on the image ***/ $imageOrg->annotateImage($draw, 60, 100, 0, "onur küçükkeçe"); ........ and as a result I get, onur küçükkeçe Any idea why it's not working? Thanks in advance. UPDATE if

ImageMagick missing decode delegates

你说的曾经没有我的故事 提交于 2019-12-07 15:13:18
问题 I recently moved to MediaTemple and installed ImageMagick and IMagick following their KB article here. No error and phpinfo() show module correctly installed. When I try to use IM on a JPG image via PHP I get this error Uncaught exception 'ImagickException' with message 'no decode delegate for this image format /home/149263/domains/wer.com/html/images/pictures/post/tmp/original/' @ error/constitute.c/ReadImage/544' in /nfs/c10/h04/mnt/149263/domains/wer.com/html/application/controllers/post

How to read SVG string in Imagick?

一曲冷凌霜 提交于 2019-12-07 12:06:46
问题 I have a string containing markup for an svg element. <svg id="someId" width="300" height="300"> <polygon id="another_id" fill="green" stroke="black" stroke-width="5" points="200,100 131,5 19,41 19,159 131,195 "></polygon> </svg> How can I read this string in Imagick and display it. $svg = '<svg id="someId" width="300" height="300"><polygon id="another_id" fill="green" stroke="black" stroke-width="5" points="200,100 131,5 19,41 19,159 131,195 "></polygon> </svg>'; $image = new Imagick(); //

Generate SVG Image using svg raw data in imagick php

为君一笑 提交于 2019-12-07 05:45:44
问题 I am trying to create svg image using svg raw data which i am getting from fabric js. I have used below code to generate the svg using svg raw data but its not working properly. public function generate_svg($raw_svg='',$prefix='',$folder_name='card_image') { $file_name = ''; if($raw_svg!='') { try{ $file_name = uniqid($prefix).".svg"; $image = new \Imagick(); $image->readImageBlob($raw_svg); $image->setImageFormat("svg"); $image->writeImage($folder_name.$file_name); } catch (ImagickException

Imagick: unable to open file

自闭症网瘾萝莉.ら 提交于 2019-12-07 04:47:06
问题 When simply calling the Imagick class: $image = new Imagick('/images/magick/atmsk.png'); I get the error message: Fatal error: Uncaught exception 'ImagickException' with message 'unable to open file `/images/magick/atmsk.png' @ png.c/ReadPNGImage/2889' in .../imag.php:4 Stack trace: #0 .../imag.php(4): Imagick->__construct('/images/magick/...') #1 {main} thrown in .../imag.php I have checked memory available as per another posting here and that is ok! 回答1: Use the full path to the image, for

Count pages in PDF file using Imagemagick - PHP

五迷三道 提交于 2019-12-07 03:58:46
问题 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 "

adding Imagick in xampp

℡╲_俬逩灬. 提交于 2019-12-07 03:22:22
问题 I have followed the following steps in http://bytehash.appspot.com/2012/02/Installing-imagick-for-php-in-windows-under-xampp i have downloaded the dll file for imagick and added this into xampp/php/ext folder and included it as follows: extension=php_imagick_ts.dll . I have also installed imagemagick and can confirm it is installed as i have run the following command: C:\>convert -version Version: ImageMagick 6.8.6-8 20 Copyright: Copyright (C) 1999-2 Features: DPC OpenMP Delegates: bzlib