imagick

Convert PDF to high quality JPG using PHP and ImageMagick

有些话、适合烂在心里 提交于 2019-12-07 02:13:28
问题 I'm tearing my hair out. I have a 300 DPI PDF that I want to turn into a 300 DPI JPG that's 2550x3300. I am told ImageMagick can do this, so I get ImageMagick to work, but it only returns a JPG that is sized about 1/5 the original PDF size. It's not the source image--I've done it with several high quality PDFs and they all have the same problem. After scouring StackOverflow for ideas, this is what I came up with to use: $im = new imagick($srcimg); $im->setImageResolution(2550,3300); $im-

How to use imagick's writeImage() function?

社会主义新天地 提交于 2019-12-06 23:29:24
问题 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

Laravel 5.2: Class Imagick not found

拥有回忆 提交于 2019-12-06 23:10:17
问题 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

How to flood fill the frame with a pattern image using imagick php class?

心已入冬 提交于 2019-12-06 14:53:33
I want to flood fill the frame with tiled image instead of color. Currently im using this codes $imagick = new \Imagick('image.jpg'); $imagick->scaleImage(300, 300, false); // Create frame placeholder $imagick->frameimage( 'red','30','30', 30, 0); // Flood fill with color $imagick->floodFillPaintImage('green', 10, '#6e0000',0, 0,false ); header("Content-Type: image/jpg"); echo $imagick->getImageBlob(); and the result: but i want a result like this Thank you very much! 来源: https://stackoverflow.com/questions/33490101/how-to-flood-fill-the-frame-with-a-pattern-image-using-imagick-php-class

Imagick (Imagemagick on PHP): serve a file without saving to disk first?

限于喜欢 提交于 2019-12-06 11:43:43
I'm trying to use Imagemagick (actually PHP's Imagick ) to create and output (serve) an image without saving it to disk first. Currently I'm having to save the file and then use verot upload class to serve the image. (Apache 2 server, PHP5) Sure. This should work for you: $image = new Imagick(); // Do your image creation stuff. Make sure to set $image->setImageFormat(); header('Content-Type: image/filetype'); // Change filetype echo $image; I admit to never having used Imagick, but just looking at the examples , echoing the image should work just fine: header('Content-type: image/jpeg');

php imagick, how to make an area transparent

人盡茶涼 提交于 2019-12-06 10:51:04
I want to make an area transparent within an Imagick object with a specific width, height and a top position. For example I need a transparent area with 30px x 30px from the 15th px to the top but I can't find a way to do it. $canvas1 = new Imagick(); $canvas1->newImage(30,60,'black','png'); Please help. You can set the opacity as follows $image->setImageOpacity(0.0); If you set it to 0.0 the image what you have crated will become transparent for more information you can Set opacity in Imagick if you want it for a particular area part then you need to change the approach by using GD library

PHP Imagick - setTextEncoding() function doesn't work

烈酒焚心 提交于 2019-12-06 09:35:28
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 I set a $text variable to something like chr(252) then I get a proper result $text=chr(252); $imageOrg

PHP convert psd to jpg, selecting image layers

巧了我就是萌 提交于 2019-12-06 08:42:36
问题 I want to be able to select which layers from a .PSD image are merged into the final .JPG output image. I can merge all of the layers in the image with: $im = new Imagick('test.psd'); $im->flattenImages(); $im->setImageFormat('jpg'); $im->writeImage('test.jpg'); However the .psd contains about 10 layers and I want to be able to specify which specific layers should be merged together, to produce the final image. For example I want to merge only layer numbers 3, 5 and 10 or the layers with

Setting an alpha channel when constructing an ImagickPixel

半世苍凉 提交于 2019-12-06 08:33:11
I am new to using ImageMagick. I am using the latest imagick extension (3.1.0rc1) with PHP. However, the documentation for imagick seems to be somewhat sparse. I want to create an ImagickPixel object with an alpha channel. The documentation states that these are some valid color values to pass to the constructor: "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc . I know that it is possible to retrive the alpha value of an ImagickPixel using getColorValue(imagick::COLOR_ALPHA); . So, how can I set an rgb color with an alpha channel during initialization of the object by passing to

PHP IMagick RGB to CMYK inverts?

五迷三道 提交于 2019-12-06 07:37:40
问题 I'm trying to convert a RGB .gif to a CMYK .gif using IMagick PHP module. I've wrote this piece of code $i = new Imagick('mosaique.gif'); $i->setImageColorspace(Imagick::COLORSPACE_CMYK); $i->setImageFormat('gif'); $i->writeImage('mosaique-cmyk.gif'); But the resultant "mosaique-cmyk.gif" still a RGB... but with inverted colors (O_O) What am I doing wrong? EDIT: I've tried with a .jpg and the image is converted to CMYK but it stills in negative. EDIT 2: I've tried to run my script making a