FAQ Database Discussion Community


PHP imagick gif to jpg - background

php,jpeg,gif,imagick,alpha-transparency
I've this gif: https://dl.dropboxusercontent.com/u/76885657/stackoverflow/2.gif (transparent background) And with this code: $im = new Imagick(); $im->readimage("example.gif"); $im->setImageAlphaChannel(11); $im->setImageBackgroundColor('white'); $im->setImageFormat("jpg"); $im->stripImage(); $im->writeImage("example.jpg"); $im->clear(); $im->destroy(); Results: https*://dl.dropboxusercontent.com/u/76885657/stackoverflow/3.jpg(without *) (gold background) But want this:...

How to stop browser making images fainter

php,google-chrome,firefox,png,imagick
I've noticed the following behaviour in Chrome and Firefox on Ubuntu Linux and Windows 8: A greyscale image containing text is perfectly legible when viewed in a picture editor, but browsers somehow make the greys much paler than the image is when viewed in them (Chrome, Firefox) Does anybody have...

Serving SVG as JPEG using Imagick and PHP

php,xml,svg,imagemagick,imagick
I have an SVG string that I want to serve as JPEG using PHP. For this (and a lot more things) I am using Imagick. Below is the code from PHP: $svg = '<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="28.125px" height="28.125px"...

check if installed php version support imagick

php,imagick
I had some php files that use imagick for resizing pictures stored on my server and after I changed server, imagick functions stopped working. In fact, if I try to use the scripts for resizing pictures (that works on old server), no resized image is created, and no error messages...

Imagick Interprets external image as HTML

php,imagemagick,imagick
The problem I'm having is that when saving an image from a specific external website (not all websites), I get an error where the image is interpreted as html and not as another image format. So far, this website is the only site that I've experienced this problem on, but...

Consistent PNG Bit output with PHP Imagick

php,png,fpdf,imagick
I have the following code to create a png swatch with a drop shadow (to dynamically insert in a PDF file using FPDF.) $shadowSwatch = $pm->clone() ; $shadowSwatch->setImageBackgroundColor('#000000') ; //Angle & Offset of Drop Shadow based on photoshop settings $angle = deg2rad(45) ; $xOffset = round(sin($angle) * 18, 0) ;...

node.js - generating 1000s of images causing heavy load [duplicate]

node.js,imagick,graphicsmagick
This question already has an answer here: How to limit (or queue) calls to external processes in Node.JS? 3 answers i am new to node.js. I want to generate a number of images by imagick,gmagick for testing purposes. The images should be name from 000001.jpg to 0x.jpg. For the...

ImageMagick No decode delegate for this image format

php,ios,imagemagick,imagick
I work under windows and wamp server. this is my PHP code with Imagick $imagick = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/' . $this->_name); where $_SERVER['DOCUMENT_ROOT'].'/'.$this->_name displays : D:/Sources/my_project/public/media/2/9/1/05201502/55450e1b6543a05201502_9.PNG I checked that image and it does exist in the folder. But Imagick throws an exception : Uncaught exception 'ImagickException' with message 'no...

PHP imagick converting image from CMYK to RGB inverts image

php,rgb,imagick
I have an image being rejected by the eBay API because of this: <ShortMessage>Source picture uses an unsupported colorspace.</ShortMessage> <LongMessage>Pictures with a CMYK colorspace are not supported; source pictures must use a RGB colorspace compatible with all web browsers supported by eBay. Submit pictures created using a camera or scanner...

Imagick: How to append a grid of images with appendImages

php,imagick,pecl
I am not using exec command in php so I don't have access to run something like the following from the manual at: http://www.imagemagick.org/Usage/layers/ where it states, "You can take this further to make a whole array of images, and build them either by rows, or by columns." convert \(...

Receiving invalid filename error when converting first page of pdf to jpg

php,pdf,imagemagick,imagick,hhvm
I'm using imagick to convert a pdf to a jpg in a script I have...it works fine if I give the direct path to the uploaded pdf without the page specified, but when I add the [0] onto the end of the file path to specify that I only want...

php imagick pixel iterator compare to next and previous pixels

php,imagick
$imagick = new \Imagick(realpath($imagePath)); $imageIterator = $imagick->getPixelIterator(); foreach ($imageIterator as $row => $pixels) { /* Loop through pixel rows */ foreach ($pixels as $column => $pixel) { if ($column % 2) { How do I compare this pixel to the one above and below and the one to the left...

PHP Imagick setImageCompression

php,imagick,image-compression
Im just starting to write some php using the Imagick / ImageMagick library, and have seen several examples regarding setImageCompression which appear to implement things differently. For example I've seen it used like this: $image->setImageCompression(Imagick::COMPRESSION_LZW); and also like this: $image->setImageCompression(\Imagick::COMPRESSION_UNDEFINED); So, what is the relevance of the backslash before declaring...

How to detect position of shape in image PHP [closed]

php,image,crop,imagick
I have image with white background and in that image i have some kind of shape - part of cloth. I need to find most left, up, right and bottom pixel. What is the most efficient way to do that?

php imagick error when pdf involved

php,pdf,iis-7.5,imagick
When I try to convert the first page of a PDF into JPG through PHP imagick, I get an HTTP 500 error with no log in php_errors.log. Explanation from IIS: The FastCGI process exited unexpectedly Error code: 0xc0000417 Two files are created in C:\Windows\Temp, the first one is the PDF...

php imagick paint all non transparent pixels one color

php,imagick
I need to convert all non transparent pixels to one color (e.g. black). I can only use the methods exposed by the php imagick extension http://php.net/manual/en/class.imagick.php as exec() is blocked on the server. what would be the quickest route to achieve this?...

PHP Imagick compositeImage set position

php,image-processing,imagemagick,imagick,watermark
I use the Imagick library for Image processing. I'm using this function: https://php.net/manual/ro/imagick.compositeimage.php How can I place the second image above the first image in the left corner for example? I'm using this function to add a watermark above all images. But the watermark is centered on all images. I...

ImageMagick SVG to PNG conversions removes gradients

php,svg,imagemagick,imagick,imagemagick-convert
I'm trying to allow users to upload an SVG image through a CMS and generate a fallback PNG so that when the CMS displays the content on the front end the PNG fallback is shown for older browsers. The problem is that when I upload an SVG the PNG output...

Translate ImageMagick CLI to PHP Imagick API

php,api,imagemagick,command-line-interface,imagick
I have problem with translating ImageMagick CLI command to Imagick PHP API. I looked at threads about it on Stackoverflow but people there used other commands... > convert color-to-add.png test.png -compose CopyOpacity mask-with-alpha.png > composite -compose multiply test.png mask-with-alpha.png compose-result.png I can't use exec method. I still try do do...

Imagick is unable to open DNG images

php,imagick
As you can see, the image _IGP4559.DNG exists but Imagick can't open it. JPEG images works just fine. readImage() returns the same error. Here is the image: http://files.patrikelfstrom.se/_IGP4559.DNG I run this in the terminal to rule out all other variables. $ ll /var/www/_IGP4559.DNG -rw-rw-rw- 1 monsun monsun 11841201 May 17...

PHP Imagick crop image with negative offset and keep negative space

php,imagemagick,imagick
I'm using php Imagick::cropImage and i'm having some trouble. Let's say I have this image: And I want to crop the image with this crop area: This is the PHP code I am using: $width = 200; $height = 200; $x = -100; $y = -50; $image = new Imagick();...