imagick

homestead+imagick

房东的猫 提交于 2019-11-29 03:19:29
1.通过终端输入命令 vagrant ssh进入虚拟机 2.进入默认Code文件夹 cd Code/ 3.切换root用户 sudo -s 4.更新包管理器 apt-get update 5.安装imagemagick: apt-get install imagemagick,安装完成后可通过convert命令查看到imagemagick版本 6.安装imagick: apt-get install pkg-config libmagickwand-dev -y 7.到pecl.php.net搜索imagick扩展压缩包 [传送门](https://pecl.php.net/package/imagick) 8.进入 /tmp临时目录 cd /tmp 9.下载压缩包 wget https://pecl.php.net/get/imagick-3.4.4.tgz 10.解压安装包 tar xvzf imagick-3.4.4.tgz 11.进入解压后的目录 cd imagick-3.4.4 12.运行phpize命令 (如果找不到命令,请补全php路径) 13.运行configure命令 ./configure 14.编译安装 make install 15.删除tmp目录下相关资源文件 rm -rf /tmp/imagick-3.4.4* 16.进入对应版本的php 修改php

Transparent to white in Imagick for PHP

人盡茶涼 提交于 2019-11-29 03:06:56
I have a png image with a transparent background and I want to convert it to a jpg image with a white background. The code is basically this: $image = new Imagick('transparent.png'); $image->writeImage('opaque.jpg'); But that creates a black background jpg. I've been struggling with the worst documentation ever trying to find a way to convert the transparent to white to no avail. Edit : Well, I tried Marc B's idea and kind of got it to work. $image = new Imagick('transparent.png'); $white = new Imagick(); $white->newImage($image->getImageWidth(), $image->getImageHeight(), "white"); $white-

Using a transparent PNG as a clip mask

☆樱花仙子☆ 提交于 2019-11-29 02:05:18
Is it possible to take this image: And apply this mask: And turn it into this: Using either GD or Imagick? I know it's possible to mask an image using shapes but I'm not sure how to go on about doing it with a pre-created alphatransparent image. :s Using Imagick and ImageMagick version > 6 (I don't know if it will work on older versions): // Set image path $path = '/path/to/your/images/'; // Create new objects from png's $dude = new Imagick($path . 'dude.png'); $mask = new Imagick($path . 'dudemask.png'); // IMPORTANT! Must activate the opacity channel // See: http://www.php.net/manual/en

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

时光怂恿深爱的人放手 提交于 2019-11-28 21:26:16
问题 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.. 回答1: This task is not easy as the "important" part may not always

How to create a large (High Quality 300dpi) image from JSON / array of Data (width,height,x,y,angels) using PHP ImageMagic / Imagick

▼魔方 西西 提交于 2019-11-28 20:19:18
I created a design (270x470) with some pictures and text on Canvas using FabricJs then i export all pictures/text information in JSON format by fabricJS's canvas.toJSON() method And Now i need to Re-Draw that design on a High Quality (2790x4560) image in PHP using Imagick. JSON dataArray for above design which contains all object's information like size,position,angle etc.. { "width": "2790", "height": "4560", "json_data": { "objects": [{ "type": "image", "originX": "left", "originY": "top", "left": "5", "top": "105", "width": "260", "height": "260", "scaleX": "1", "scaleY": "1", "angle": "0",

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

喜夏-厌秋 提交于 2019-11-28 16:50:58
问题 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? 回答1: 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){

Howto: Install Imagick (for php) on Ubuntu 11.10

无人久伴 提交于 2019-11-28 16:47:52
I'm attempting to install ImagicK as its required for a Yii Extension I want to use for my project. I've checked around and followed a few different suggestions but nothing that has worked so far, ultimately the framework extension is still throwing me an error (Must have ImagicK installed). I've tried things like: sudo apt-get update sudo apt-get install imagick-php5 .. etc as well as the PECL install which ends up throwing me the following error: Checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config

how to change the DPI of an image from 72DPI to 300DPI with Imagick

不羁岁月 提交于 2019-11-28 13:59:21
I have an image of 72DPI and i want to change this to 300DPI for printing purposes, I want all the stuff need to be done with imagick, tried with the code following but no positive results. <? $im = new Imagick(); $im->setResolution(72,72); $im->setOption('density','300x300'); $im->readImage("test.png"); header("Content-Type: image/png"); echo $im; ?> can someone help/clarify me the usage of setoption or can some one explain hot to change DPI in either iMagick or GD I think this is what you want: I have setted resolution as pixel/inch with 300 dpi: <?php $im = new Imagick(); $im->setImageUnits

Imagick on heroku - is it possible?

偶尔善良 提交于 2019-11-28 12:19:32
I need to do some actions on jpeg images - Heroku's PHP GD does not allow that. I've read that it is possible with Imagick, so i rewritten the code, pushed it to heroku and... PHP Fatal error: Class 'Imagick' not found in [...] So am I doing something wrong(code works locally)? $tlo = new Imagick(); $tlo->newImage(640, 480, new ImagickPixel('white')); $tlo->setImageFormat('jpg'); Is there any way of working with jpg on heroku? ImageMagick, a command-line utility and programming library, must be installed on the system for Imagick to work. If it's not working for you, then presumably Heroku's

how to use imagick annotateImage for chinese text?

大憨熊 提交于 2019-11-28 11:20:08
I need to annotate an image with Chinese Text and I am using Imagick library right now. An example of a Chinese Text is 这是中文 The Chinese Font file used is this The file originally is named 华文黑体.ttf it can also be found in Mac OSX under /Library/Font I have renamed it to English STHeiTi.ttf make it easier to call the file in php code. In particular the Imagick::annotateImage function I also am using the answer from "How can I draw wrapped text using Imagick in PHP?" . The reason why I am using it is because it is successful for English text and application needs to annotate both English and