How to stop GD2 from washing away the colors upon resizing images?

I’ve managed to further test this with Imagick: The left half of the image was processed with Imagick and the sRGB_IEC61966-2-1_no_black_scaling.icc color profile, the right half has no color profile associated and shows exactly the same if processed with Imagick or GD; here is the code I used: header(‘Content-type: image/jpeg’); $image = new Imagick(‘/path/to/DSC07275.jpg’); if … Read more

Convert SVG image to PNG with PHP

That’s funny you asked this, I just did this recently for my work’s site and I was thinking I should write a tutorial… Here is how to do it with PHP/Imagick, which uses ImageMagick: $usmap = ‘/path/to/blank/us-map.svg’; $im = new Imagick(); $svg = file_get_contents($usmap); /*loop to color each state as needed, something like*/ $idColorArray = … Read more