-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GIF support #12
Comments
Hi, What kind of gif support do you need? You can use imaging.Open to load a gif image. But you cannot use imaging.Save to save to gif file. The reason for this is that the GIF encoding was introduced in standard library with Go 1.2. And I want to keep the library compatible with older Go versions. If you use Go version >= 1.2 you can use the standard image/gif package to save to gif format. For example (not tested): import (
"image/gif"
"os"
)
func SaveGIF(img image.Image, filename string) (err error) {
file, err := os.Create(filename)
if err != nil {
return
}
defer file.Close()
err = gif.Encode(file, img, &gif.Options{NumColors: 256})
return
} |
Your example code is very helpful. |
just wondering.. but whats the point of trying to be compatible to Go versions < 1.2 .. ? |
To not break other people's code that depends on this library. Saving GIFs can be implemented with just a few lines of code if needed. |
Is this argument still valid? It is 2019. |
@ernsheong The support for GIF format in |
Dear Grigory Dryapak,
This is completely awesome open source code project, But it does't support GIF file.
Can you please provide GIF support for this.
Thank you.
The text was updated successfully, but these errors were encountered: