Merging rotated gif onto background gives color differences

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
fommes

Merging rotated gif onto background gives color differences

Post by fommes »

Hi there,

I use the following code to rotat a gif image:

convert imageframe.gif -background none -rotate $rotation -transparent white overlay_images/tmpImages/rotation_{$tempimage}_{$i}.gif"

Now what i do in short, i make 4 frames with this and then merge the 4 on a certain background and then merge the whole into one animated gif and the result you wil get is :

non rotated animation on a background:
http://fotobling.fotopocket.nl/view.php?id=42

rotated using imagemagick on a background:
http://fotobling.fotopocket.nl/view.php?id=41

As you can see the product quality of the rotated version is lower then without a rotated gif it seems that the palletes of the 4 merged gifs are different somehow, is there some method i can use to stop the pixels from changing color ?

Thanks in advance!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merging rotated gif onto background gives color differences

Post by fmw42 »

Use a common colortable with or without dithering via -map

see http://www.imagemagick.org/Usage/quantize/#map
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Merging rotated gif onto background gives color differences

Post by anthony »

rotateing does produce a much larger color map. That is the nature of any image distortion be it rotates or resizes. You will need to
fix the color name if that is what you need.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
fommes

Re: Merging rotated gif onto background gives color differences

Post by fommes »

How would i change the color name 'automated' ?
If you take a look at http://fotobling.fotopocket.nl visitors can upload a picture and add the animated gifs on top of it, in a flash environment, when they hit save the image should be created (rotating any rotated gifs, then merging it all together into a animated version)
Is there a way to get all the colors the same for each frame? maybe get the colortable for the first frame, and then add it to the next frame ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Merging rotated gif onto background gives color differences

Post by fmw42 »

fommes wrote:How would i change the color name 'automated' ?
If you take a look at http://fotobling.fotopocket.nl visitors can upload a picture and add the animated gifs on top of it, in a flash environment, when they hit save the image should be created (rotating any rotated gifs, then merging it all together into a animated version)
Is there a way to get all the colors the same for each frame? maybe get the colortable for the first frame, and then add it to the next frame ?

see -map and related discussion

http://www.imagemagick.org/Usage/quantize/#map

The first image can be the colortable for all the rest of the image when using -map
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Merging rotated gif onto background gives color differences

Post by anthony »

Especially note +map for animations. That will ensure a command global color map is used rather thna individual (slightly different) local color maps, even for the same given color map.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
fommes

Re: Merging rotated gif onto background gives color differences

Post by fommes »

Thanks alot fmw42 and anthony i'll try it today!
fommes

Re: Merging rotated gif onto background gives color differences

Post by fommes »

Hi!

I got it working now, i -map the rotated gif with the colortable of the original version of the gif, then i merge it onto the background

result:

http://fotobling.fotopocket.nl/view.php?id=58

Thanks for all the help!
Post Reply