imagick

Convert .psd and .ai to PNG/JPG with imagick

我只是一个虾纸丫 提交于 2019-11-29 21:04:00
I'm creating thumbnails for a Digital asset manager, what is the best way to do this with imagemagick? is there good resource out there? I solved it and will share with the WORLD! it will convert .ai, .psd, .jpg, .png, .gif into thumbnails. Here is a function that takes 4 params: $dir - directory to save to. $tmpName - the name to name the file excluding the extension. $fileType - self explanatory. $size - Large or small. function thumbGenerator($dir,$tmpName,$fileType,$size){ $saveFileType = "png"; $imagePath = $dir.$tmpName.".".$fileType; $image = new Imagick(); $image->readimage($imagePath)

Scale image according a maximum file size

半城伤御伤魂 提交于 2019-11-29 16:44:07
I'm using Imagick and like to scale an image to a maximum file size of 2.5MB I had a look to this SOF question: ImageMagick: scale JPEG image with a maximum file-size which is exactly what I want to do but the extent() method from Imagick does not have the size parameter: http://www.php.net/manual/en/imagick.extentimage.php Anyone knows how I could to it? At the moment I'm trying to calculate a coefficient between the original file size and the target file size to calculate a new resolution but found out that the resolution is not proportional to the file size. Update - The output format is

Header location not working properly

流过昼夜 提交于 2019-11-29 12:47:42
I have a php script that renders an image (with imagick) and saves it to some directory "SITE_ROOT.$filePath" , then does a header('Location: ' . SITE_ROOT.$filePath) , the file it redirects to is a png image. If I go to the path directly, like just type it in the URL bar I can save the image and everything works fine, however when I rely on the script to redirect me and I try to right click and save the image it doesn't recognise that I'm actually trying to save an image, it thinks I'm trying to save it as a non-typed file called 'Driver' which is the name of the script page. I have no idea

PHP+Imagick - PNG Compression

浪尽此生 提交于 2019-11-29 10:22:15
How do I efficiently compress a PNG? In my case, the images are small grayscale images with transparency. Currently I'm playing with this: // ... $im->setImageFormat('png'); $im->setImageColorspace(\Imagick::COLORSPACE_GRAY); $im->setImageCompression(\Imagick::COMPRESSION_LZW); $im->setImageCompressionQuality(9); $im->stripImage(); $im->writeImage($url_t); As Imagick doesn't offer COMPRESSION_PNG , I've tried LZW but there's almost no change in the filesize (usually it's even bigger than before). If I open the image in GIMP and simply save it, the filesize gets drastically reduced (e.g. 11,341

How to install ImageMagick on Windows 7 (2)

ぐ巨炮叔叔 提交于 2019-11-29 10:15:07
问题 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

Imagick php windows

孤街醉人 提交于 2019-11-29 09:40:21
问题 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

Issue with Imagick and also with phmagick: Postscript delegate failed / No such file or directory

对着背影说爱祢 提交于 2019-11-29 09:17:31
问题 I'm using imagick 3.0.1 and also phmagick (http://www.francodacosta.com/phMagick/download). No matter what, both are giving me the same kind of error when I try to convert a PDF to JPEG. For example: Postscript delegate failed `/tmp/magick-bfxIrUJ5': No such file or directory @ error/pdf.c/ReadPDFImage/669 I'm using Ghostcript-9.05 (running on /usr/local/bin/gs). Also ImageMagick-6.7.6-8 (running on /usr/local/bin/convert). I already checked folder's permission (755). ImageMagick works

PHP/Imagick/PDFlib Flop Image Changes its Bit Depth

情到浓时终转凉″ 提交于 2019-11-29 08:41:56
I am Having PNG Image And Trying To Flop (Mirror) by imagick function of php It Gets Flop Exactly But The Base Image is In Format 24 Bit RGB and after Convertion It Gets To 8 Bit Pallated . So the Main Problem is that when I use to place both images in my pdflib pages one of the image(converted) displays curly.... Original Image Output After Flop(Mirror) by Imagick and Rendered in PDFlib -> My Code Is Simple ----> $im = new Imagick($background_image); $im->flopImage(); $im->writeimage($background_image."_flop.png"); Modified Date => 29 Oct 2013 Original Image -> Size 4.68 KB Bit Depth 32

how can i change the dpi of an image with the imagick extension

我怕爱的太早我们不能终老 提交于 2019-11-29 07:29:16
I need to change all uploaded files to 72 dpi. I'm using the php imagick extension. heres what i've tried (the image i'm using is 300dpi): $image = new Imagick(); $image->setResolution(72,72) ; $image->readImage($img); $image->resampleImage (72,72,imagick::FILTER_UNDEFINED,1); $image->writeImage($target) this doesn't seem to anything. the image is uploading, but stays at 300dpi MatTheCat's answer is spot on. You might also try setImageUnits() to ensure it's working with inches and not centimeters. $image->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH); $image->setImageResolution(72,72);

Imagick: compose with mask

纵饮孤独 提交于 2019-11-29 05:44:01
I try to recreate a script that uses the ImageMagick command "convert" to compose an image. But I want to do the same in PHP using Imagick (version 6.6.2-10). The command is as follows: convert A1.mpc A3.mpc A4.mpc -channel rgba -alpha on -virtual-pixel background -background none -define compose:args=312x26.6776 -compose displace -composite out.mpc I found out that the parameters stand for the following: convert {background} {overlay} [{mask}] [-compose {method}] -composite {result} The PHP Imagick gives me a compose method, but without a mask parameter: http://www.php.net/manual/en/imagick