Saving as .gif or .jpeg lack colours, but .png is okay?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
lemon777

Saving as .gif or .jpeg lack colours, but .png is okay?

Post by lemon777 »

Hi there,

I have checked the forums, mailing lists and the web, but in my luck at this time can find nothing about why when I add dropshadows to images, they work fine for .png but the gradient is lost for .gif or .jpeg? The drop shadow becomes more or less solid (instead of gradient) for .gif!?

I have searched on alpha/transparency settings, and remain confused.

Works fine if I use another program to convert the .png to .gif. (drop shadow colors copy over).

Using Imagick ver 6.4.1 for PHP 5.2.0.

Cheers.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Saving as .gif or .jpeg lack colours, but .png is okay?

Post by anthony »

GIF only allows fuly transparent or opaque. as such semi-transparent shadows are lost.

JPEG does not allwo transparency at all.


In either case 'flatten' your image onto some background color as per IM examples for those formats
http://www.imagemagick.org/Usage/formats/#jpg_trans
http://www.imagemagick.org/Usage/formats/#bgnd
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
lemon777

Re: Saving as .gif or .jpeg lack colours, but .png is okay?

Post by lemon777 »

Thanks, excellent reply. :) Works great!
Post Reply