Recommendation for compressing JPG files with ImageMagick

I use always: quality in 85 progressive (comprobed compression) a very tiny gausssian blur to optimize the size (0.05 or 0.5 of radius) depends on the quality and size of the picture, this notably optimizes the size of the jpeg. Strip any comment or EXIF metadata in imagemagick should be convert -strip -interlace Plane -gaussian-blur … Read more

Replace transparency in PNG image with white background

-background white -alpha remove -alpha off Example: convert image.png -background white -alpha remove -alpha off white.png Feel free to replace white with any other color you want. Imagemagick documentation says this about the -alpha remove operation: This operation is simple and fast, and does the job without needing any extra memory use, or other side … Read more

Convert PDF to image with high resolution

It appears that the following works: convert \ -verbose \ -density 150 \ -trim \ test.pdf \ -quality 100 \ -flatten \ -sharpen 0x1.0 \ 24-18.jpg It results in the left image. Compare this to the result of my original command (the image on the right):    (To really see and appreciate the differences between … Read more

Converting a PDF to PNG

You can use one commandline with two commands (gs, convert) connected through a pipe, if the first command can write its output to stdout, and if the second one can read its input from stdin. Luckily, gs can write to stdout (… -o %stdout …). Luckily, convert can read from stdin (convert -background transparent – … Read more

Remove EXIF data from JPG using PHP

Use gd to recreate the graphical part of the image in a new one, that you save with another name. See PHP gd edit 2017 Use the new Imagick feature. Open Image: <?php $incoming_file=”/Users/John/Desktop/file_loco.jpg”; $img = new Imagick(realpath($incoming_file)); Be sure to keep any ICC profile in the image $profiles = $img->getImageProfiles(“icc”, true); then strip image, … Read more

Convert PDF to JPEG with PHP and ImageMagick

It can be done using setResolution, but you need to do it before loading an image. Try something like this: // instantiate Imagick $im = new Imagick(); $im->setResolution(300,300); $im->readimage(‘document.pdf[0]’); $im->setImageFormat(‘jpeg’); $im->writeImage(‘thumb.jpg’); $im->clear(); $im->destroy();

How to install Imagick/imagemagick PHP extension on windows 7

Check permissions on the .dll file to make sure the Apache user has read access to the file. Better change the permission of the [PHP]/extension directory. To change the permission Right click the file(s) or folder(s) Select “Properties” Select “Security” tab Click on “Edit” button. Change the permission of user to Full Control.