Forums | Admin

Discussion Forums: Hints and Tips

Start New Thread Start New Thread
Message: 1994
BY: Tim Hunter (rmagick)
DATE: 2004-09-18 14:21
SUBJECT: Forcing RMagick to use the GIF89a format

 

ImageMagick and GraphicsMagick support two variations on the GIF format: GIF87a and GIF89a. When you use ".gif" as the filename extension, xMagick may use either format. You can explicitly specify the older format by using the GIF87: prefix or a ".gif87" extension, but there is no equivalent GIF89: prefix or any other way to specify the GIF89a format.

Suppose you need your images to be in the GIF89a format. What can you do?

When you write an image file with a GIF: prefix or .gif extension, ImageMagick/GraphicsMagick uses the GIF87a format unless the image has (or may have) a GIF89a feature. ImageMagick/GraphicsMagick will use the GIF89a format if the image has any one of these properties:

1. If the image may be multi-frame. (The image does not have to have more than one frame, ImageMagick/GraphicsMagick just has to "think" it could have more than one frame.)

2. If the image may have a transparent color. That is, if the `matte' attribute is set to true.

3. If the image has a comment property.

This means you can force ImageMagick/GraphicsMagick to use GIF89a by any one of these three methods:

1. Use the ImageList#write method. This method tells ImageMagick/GraphicsMagick to assume that the image has multiple frames.

2. Set the image's `matte' attribute to true.

3. Create a `comment' property on the image. For example,

img['comment'] = 'This is my image'


Thread View

Thread Author Date
Forcing RMagick to use the GIF89a formatTim Hunter2004-09-18 14:21
      RE: Forcing RMagick to use the GIF89a formatshelly qi2012-09-12 02:31

Post a followup to this message