Skip to content
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

--crop-transparency only seems to trim the bottom and right transparency #169

Open
scheibo opened this issue Jul 16, 2021 · 5 comments
Open

Comments

@scheibo
Copy link

scheibo commented Jul 16, 2021

When I try to use gifsicle --crop-transparency 218.gif -o cropped.gif on the following image I get a new gif which is trimmed but which only seems to have had the transparency removed from the bottom and right of the image:

  • Before:
  • After:

However, if I use https://ezgif.com/ with the "trim transparent pixels around the image" option and select "Crop with: Gifsicle" I get the properly cropped image that I would expect:

  • Ezgif:

I understand this project has no association with https://ezgif.com/, but the fact that they claim to be using Gifsicle in this instance makes me believe that I should be able to achieve the same results and that I must simply be "holding it wrong". Am I missing something basic? If it helps: I'm using Gifsicle 1.93 and I've tried the command on both Ubuntu Linux and on macOS Catalina.

Thanks!

@scheibo
Copy link
Author

scheibo commented Jul 21, 2021

I reached out the ezgif.com and they explained that they actually have the same issue and that the workaround was to call Gifsicle 4 times as a workaround: crop-transparency, rotate-90, crop-transparency, rotate-90 etc. Hopefully any other user that stumbles across this bug via Google can benefit from this clever workaround as well (though obviously actually fixing Gifsicle to make this workaround unnecessary is still desirable)!

$ gifsicle --crop-transparency input.gif -o output.gif
$ gifsicle --rotate-90 -b output.gif
$ gifsicle --crop-transparency -b output.gif
$ gifsicle --rotate-90 -b output.gif
$ gifsicle --crop-transparency -b output.gif
$ gifsicle --rotate-90 -b output.gif
$ gifsicle --crop-transparency -b output.gif
$ gifsicle --rotate-90 -b output.gif

@TPS
Copy link

TPS commented Oct 23, 2021

If bottom & right cropping works correctly, wouldn't just

$ gifsicle --crop-transparency input.gif -o output.gif
$ gifsicle --rotate-180 -b output.gif
$ gifsicle --crop-transparency -b output.gif
$ gifsicle --rotate-180 -b output.gif

be enough?

@scheibo
Copy link
Author

scheibo commented Oct 27, 2021

Ahah yes, oops! diff seems to report it gives the same result. Which is great for cutting the workaround in half, but its disappointing a workaround is needed in the first place.

@TPS
Copy link

TPS commented Oct 27, 2021

I think EZGIF should've figured out that workaround, too. Maybe they've got someone to help contribute a fix back here?

@scheibo
Copy link
Author

scheibo commented Oct 27, 2021

ezgif actually is already using 180, I had just somehow managed to interpret it incorrectly despite it being quite explicit: https://twitter.com/ezgif_com/status/1417713291410001921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants