ImageMagick and Ghostscript
Posted by: Svends1 (---.hjlubri.com)
Date: January 05, 2016 04:12PM

Hi All

I'm using Wampserver 2.5 with php 5.5.12 and all Works fine.

I've installed Wordpress 4.4 and that is also working fine. Now I have tried to setup a plugin (https://wordpress.org/support/plugin/pdf-image-generator) and it needs ImageMagick and Ghostscript.

I have managed to get ImageMagick to Work and have installed Ghostscript for Windows. Now I'm not sure what to do.
As I understand Imagemagick can support PDF's, but I don't know how to get ghostscript to run with ImageMagick.

Looking at my phpinfo gives me the following ImageMagick supported formats:

3FR, AAI, ARW, AVI, AVS, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIP, CLIP, CLIPBOARD, CR2, CRW, CUR, DATA, DCR, DDS, DFONT, DJVU, DNG, DOT, DPS, DXT1, DXT5, EMF, EPT, EPT2, EPT3, ERF, EXR, FAX, FPX, FRACTAL, G3, GIF, GIF87, GRADIENT, GV, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNX, JP2, JPC, JPM, JPT, K25, KDC, LABEL, M2V, M4V, MAC, MAP, MASK, MATTE, MEF, MIFF, MKV, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PANGO, PATTERN, PCD, PCDS, PCT, PDB, PEF, PES, PFA, PFB, PICT, PIX, PLASMA, PREVIEW, PWP, RADIAL-GRADIENT, RAF, RAW, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, TEXT, THUMBNAIL, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VID, WBMP, WEBP, WMF, WMV, WPG, X3F, XBM, XC, XCF, YUV

Has anyone been able to get ImageMagick to Work with PDF/Ghostscript?

Thanks in advance
Michael

Options: ReplyQuote
Re: ImageMagick and Ghostscript
Posted by: RiggsFolly (---.as43234.net)
Date: January 05, 2016 04:22PM

Hi

This is the process I used, some time ago now, but for what its worth, see if it helps you

How it should work!

Download the Imagick software from The Imagick binary release page

If you are running WAMPServer 32bit then you need the ....Q8-x86-dll.exe or the ....Q16-x86-dll.exe
- Q8 = 8 bits-per-pixel component
- Q16 = 16 bits-per-pixel component

This is an installer exe file. I recommend using the Q16 versions as these seem to be what the PECL php_imagick.dll gets compiled with.

Read the Imagick download page there will be a reference to any external DLL's that it may require specifically the MSVC Runtime library it is compiled with.
You should check you have this installed BEFORE installing Imagick, the version as of writing this is VC12 (VS2013) but this will change over time, CHECK IT although you should already have it installed as Apache/PHP will need the same version of the C/C++ runtime anyway!


Run the installer, now you can install this anywhere, but I change the path that it is installed into to my ?:wamp folder eg. C:\wamp\imagemagick

The last step of the install is to run a test, do as it says on the last windows of the install. If the install has worked you can run it form any folder/drive as the install will have added the drive:\folder that you installed into to your PATH, it will create a wizard.jpg file in the current folder, you may want to delete this after the test, assuming the test works.


NOW FOR THE PHP Extension:

At the bottom of the The Imagick binary release page you should see a link to Application Programming Interfaces.

Click the PHP - IMagick link, this will take you to a PECL page with a list of releases, avoid the Release candidates[RC] or beta release, unless you know what you are doing.
Select the DLL link on the row containing the release you want for the version you want to download. (see later for how to find older releases)
- This will lead you to another PECL page where you will find the download links for php_imagick.dll.
- - Note that they are specific to PHP Version and 32/64 bit of the PHP they are to be used within.
- - Also specific to Apache/PHP configuration. For WAMPServer you need the Thread Safe version.
If you, like me, have versions of PHP from 5.3 through 5.6 & PHP7 you may need to download a seperate version for PHP5.3 & PHP5.4 & PHP5.5 & PHP5.6
- There is no version of php_imagick.dll for PHP7 yet, but there may well be when you come to read this.

Download which ever verions of php_imagick you need. These are zip files.
- unzip the downloaded file
- copy the php_imagick.dll from the unzipped folder to your \wamp\bin\php\php{version}\ext folder

Now we need to add an extension line to the php.ini for the versions(s) of PHP you are currently running.
- Using the wampmanager menus, edit the php.ini file
- - wampmanager -> PHP -> php.ini
- - this will open the correct php.ini file. Locate the section of the php.ini where all the extensions are included and add
- - extension=php_imagick.dll

Now start WAMPServer, or restart Apache if it was already running.
- Check the


GhostScript from Ghostscript download page, GNU Affero General Public License
Pick the 32bit or 64bit version that matches your OS and WAMPServer

Run the downloaded exe, it is an installer.

Again install into the \wamp folder

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: ImageMagick and Ghostscript
Posted by: Svends1 (---.hjlubri.com)
Date: January 06, 2016 08:43AM

Hi RiggsFolly

Thank you very much for your detailed description.

However all the ImageMagick steps is done and it Works.
I also see the imageMagick extension at my phpinfo page.

The problem is the Ghostscript part.....


The exe is downloaded and installed to it's own folder, but I'm not completely sure what you mean with the frase
"Again install into the \wamp folder". Is there a dll from the Ghostscript package that I need to place in the php/wamp/apache folder?

Thanks
Michael

Options: ReplyQuote
Re: ImageMagick and Ghostscript
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: January 06, 2016 10:32AM

Hello

I dont think you interface directly with GhostScript only Imagic needs to know its there and only imagic will make use of it directly.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.