Skip to content

image/gif: encoder does not honor image bounds. #6635

@gopherbot

Description

@gopherbot

by dan.pupius:

1. Open a image using gif.DecodeAll
2. Replace frame(s) with a `SubImage`, e.g. to make a square crop
3. Save image using gif.EncodeAll

What is the expected output?
Saved image should correctly show cropped region

What do you see instead?
Resultant image is incorrectly offset, see lucha.out.gif vs lucha.out.jpg

Which operating system are you using?
OSX

Which version are you using?  (run 'go version')
$ go version
go version devel +560ca6cc94b5 Sun Oct 20 18:29:15 2013 -0700 darwin/amd64

Please provide any additional information below.
I think the sImageDescriptor block in gif/writer.go needs to have the X/Y values
adjusted by the Min bounds of the first frame.

Attachments:

  1. gifs.go (966 bytes)
  2. lucha.gif (7598 bytes)
  3. lucha.out.jpg (17750 bytes)
  4. lucha.out.gif (6843 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions