PDF to Raster image, mistake in render - imagemagick

I have deployed a PHP application to a new server with more recent version of ImageMagick and PHP, however, the new server (ImageMagick) does a poor job at converting PDF to raster (jpg or png).
Here is the PHP code I run on both servers (with identical input file)
$im = new Imagick();
$im->setResolution( 72, 72 );
$im->readImage( 'vector.pdf' );
$im->setImageFileName('output-old.jpg');
$im->writeImage();
The generated files look like this
Generated file on old server (looks correct)
http://i.stack.imgur.com/owai5.jpg
Generated file on new server (problems)
http://i.stack.imgur.com/xg3kv.jpg
Original PDF
https://drive.google.com/file/d/0B9RgJSi9aRIJcUJYd2Z4bzFDTTA/view?usp=sharing
NOTE: same problem occurs when using ImageMagick via command line
convert vector.pdf output.jpg
Old Server Configuration
PHP: 5.3.10
ImageMagick: 6.7.6-0 2012-03-16 Q16
OS: Ubuntu 12.04
New Server Configuration
PHP: 5.6.13
ImageMagick: 6.9.2-3 Q16 x86_64 2015-09-23
OS: CentOs 6.5
You would expect the later version of ImageMagick to work better and would rather use that if possible.
Could the problem be in a configuration file or a dependant library? Will provide more server details if needed.

I fixed the problem by updating ghostscript
The new server only had ghostscript 8.7, I upgraded to 9.16
You can get you ghostscript version usually by running
gs --version

Related

After Upgrading from Alfresco 4.2 to 5.2, Transformation is not working for .TIF Image files

I have migrated one Application from Alfresco 4.2 version to Alfresco 5.2 version.
But after up-gradation Image preview is not displaying for any file and Transformation is not working.
Console Logs:-----
2018-02-02 08:58:46,022 INFO [repo.jscript.ScriptNode] [http-apr-8080-exec-25] Unable to create thumbnail 'doclib' for image/tiff as no transformer is currently available.
2018-02-02 08:59:10,076 WARN [jcms.transform.TesseractOCRTransformer] [http-apr-8080-exec-45] Command options did not appear to contain ImageMagick setting for monochrome, cannot invoke Tesseract.
Can anyone please help with this, or any work around to solve this issue.
your valuable reply will be really appreciated.
For more details about issue, please find attached screen-shot.
In the Alfresco Community 5.2 on Windows the ImageMagick install is borked. I found a workaround:
Install ImageMagick from the developer site
https://www.imagemagick.org/script/download.php
Edit the alfresco-global.properties found in C:\alfresco-community\tomcat\shared\classes
Change the img.root value to point to your fresh installation, like this:
img.root=C:\\PROGRA~1\\ImageMagick-7.0.7-Q16
Restart the alfresco server
NOTE: You will see this in the logs before:
err: convert.exe: RegistryKeyLookupFailed `CoderModulesPath' # error/module.c/GetMagickModulePath/670.
convert.exe: no decode delegate for this image format `GIF' # error/constitute.c/ReadImage/509.
Afterwards that error will not be present in the logs.
There's a setenv.bat file that sets up some Imagemagick related environment variables. I suspect they're missing from the build that you have, either by yours or Alfresco's mistake.
After you installed Imagemagick separately, that installation simply took care of these variables.
They go something like this:
MAGICK_HOME="/srv/alfresco-3.4.a/common"
MAGICK_CONFIGURE_PATH="/srv/alfresco-3.4.a/common/lib/ImageMagick-6.5.1/config:/srv/alfresco-3.4.a/common/share/ImageMagick-6.5.1/config"
MAGICK_CODER_MODULE_PATH="/srv/alfresco-3.4.a/common/lib/ImageMagick-6.5.1/modules-Q16/coders"

Imagemagick support for Ruby on Rails Windows

was trying to download Window Binary Release for ImageMagick installation in Windows 7 Rails 4.2.4 , Ruby 2.1.5.
however all the download links returned not found.
ImageMagick windows binary release link
Are there any alternative links to download the file so that a proper installation can be done?
I've just followed the link you provided, and tried:
http://www.imagemagick.org/download/binaries/ImageMagick-6.9.3-7-Q16-x64-dll.exe
ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/ImageMagick-6.9.3-7-Q16-x64-dll.exe
and a couple of others, and they all started a download. It's either a temporary thing with that server, or if permanent, your setup. Machine/ISP/Country comes to mind.
https://www.imagemagick.org/script/download.php
Also provides some mirrors, I see the German one has windows binaries.

cloudbees imagemagick resize does not works

I'm trying to deploy a grails application on cloudbees.
In order to do that, I have a Jenkins job that builds the war and it deploy it.
My application uses ImageMagick in order to resize pictures.
After reading on cloudbees site that their servers have already ImageMagick installed, I did a test:
In my Jenkiks job a have a "execute shell" part where I put :
convert --version
When running the job, everything works fine and I see on the console output:
+ convert --version
Version: ImageMagick 6.7.5-6 2012-08-11 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
My application uses im4java wrapper.
When I try to resize a picture in my application I have the following error:
org.im4java.core.CommandException: java.io.IOException: Cannot run program "convert": error=2, No such file or directory
So, I don't understant why does not works since ImageMagick is installed.
Can you please give me some idea ?
Thanks.
C.C.
I guess the problem here is that ImageMagick is installed as a build tool on the development environment (DEV#cloud) but not on the stack you are using for the runtime environment (RUN#cloud). I cannot see any ImageMagick dependency added into the Tomcat 6-7 stack.
Only way to have imagemagick on runtime is to create a specific new stack which makes it available for you. So need to fork the git repo and use genapp as a development tool for the new stack.

How to install Image Magick for MAMP (Pro) on Mountain Lion (10.8.2)

I've been searching for a way to install Image Magick on my Mountain Lion setup (where I use MAMP Pro). I did find this article, but it isn't specific to ML. Also found a couple other similar questions here on SO but they were too specific I think. Doesn't help that I'm not great at this sort of thing. Can anyone point me to a good resource?
As was pointed out in erwinheiser's comment, MAMP 3 now comes with imagemagick pre-installed. I checked MAMP's User Guide (PDF) and found this:
The ImageMagick PHP module is included by default, but you must enable it inside the php.ini template file. Remove the ‘;’ from the following line.
;extension=imagick.so
And how do you find and change the (right) php.ini file for MAMP Pro?
From MAMP's menu choose File › Edit Template › PHP › [the latest version]
or use the keyboard shortcut: ⌘4
Make the edit. (Imagick was was at line 542 in mine.)
Save and close the file.
MAMP asks if you want to restart the servers now, choose yes.
And you're done!
Make sure you check out Joel Farris' answer if you're using an up-to-date version of MAMP
I finally managed to get it installed properly using Homebrew and the instructions here: http://egoco.de/post/23167969231/installing-imagemagick-for-php-and-mamp
I did have to run brew doctor and brew link a couple of times to fix dependencies (and change permissions on a file or two), and use
brew install php54-imagick
rather than the one mentioned at the url.
The extension he mentions at the end (the bit you have to paste in your different ini files) is:
[imagick]
extension="/usr/local/Cellar/php54-imagick/3.1.0RC2/imagick.so"
Hope it helps!
MAMP comes with Imagick installed. I have MAMP v3.2.1 (not MAMP Pro) running on OS X 10.10.3 (Yosemite).
I enabled imagick by editing php.ini file which comes with MAMP.
php.ini file is available on the following path:
/Applications/MAMP/bin/php/php5.6.7/conf/php.ini
Replace 5.6.7 with your php version number.
php.ini file will contain the following line:
;extension=imagick.so
Change that line to:
extension=imagick.so
Now restart the MAMP servers and you are good to go.
We made a Mac installer package here— http://www.cactuslab.com/imagemagick/

ImageMagick is installed, but php extension of Imagick is not enabled

Hy there,
I have a shared hosting account. They installed Image Magick on my request. But I get this error.
PHP Fatal error: Class 'Imagick' not found in /home/hamrohos/public_html/test.php on line 6
I told them what was wrong. They replied
ImageMagick is installed, but php extension of Imagick is not enabled on shared accounts
Now my question is Can I use Image magick or its any features if its php extensions are not enabled?
Currently I am using GD library but it doesnot have all features of image magick.
I have following features disabled too.
phpinfo(), exec(), system(), passthru()
Without enabling ImageMagick extension in PHP, you won't be able to use the functions it providesdirectly.
The only way to use ImageMagick in this scenario would be to call it with a system function and execute everything as a shell script. You would have to save the image data on disk to do this and after processing them with imagemagick, you would have to load them again.
Thus, It would definitely be feasible, but with severe overhead and changes to your scripts.

Resources