-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
image/gif: encoder does not honor image bounds. #6635
Comments
Labels changed: added priority-later, packagebug, removed priority-triage. Owner changed to @nigeltao. Status changed to Accepted. |
Here's a workaround, should anyone else hit this issue. You have to create a new zero based image for each frame and instead of using SubImage copy the crop region 35c36,41 < im.Image[index] = frame.SubImage(dstBounds).(*image.Paletted) --- > // Creates a new image bounded at (0,0) and instead of creating a SubImage, > // copy the cropped region into a new image. > b := image.Rect(0, 0, dstBounds.Dx(), dstBounds.Dy()) > pm := image.NewPaletted(b, frame.Palette) > draw.Draw(pm, b, frame, dstBounds.Min, draw.Src) > im.Image[index] = pm |
In This seems to be a legitimate output, since each Image Descriptor may have different dimensions and offsets from the Screen Descriptor (as long they stay within the bounds of Screen Descriptor). |
While investigating any link between GIF issues, the documentation does not specify that the original size of the GIF (image config) is kept after crop. You cannot update the config of the image (logical screen descriptor) after cropping and it is not set to the minimal size. On
The original issue with adapted logical descriptor (image config) while keeping the offset.
Latest behaviour produces a correct GIF by retaining the original Logical Descriptor.
A simplified GIF structure without offset. |
by dan.pupius:
Attachments:
The text was updated successfully, but these errors were encountered: