-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Expanded .ani and .cur functionality #6606
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Turns out it was much easier to implement .cur file saving (as it shares a lot with ICO). So I remodified CurImagePlugin to add that functionality. I reverted the BmpImagePlugin changes. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Alright, made some significant modifications. I believe I have mostly resolved all the .cur file issues, but tests need to be written for a few. I have also further expanded this functionality to work with .ani files. You can now read and write them. I also plan to work on tests for them in the future. |
@radarhere |
Oh, this apparently seems to be similar to my work in #6965 and https://github.com/akx/Pillow/tree/cur-support... |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Currently the BmpImagePlugin checks if a file is a .cur file by checking if the bits are 32 and a the header is 22. However, the header for cursor files is not guaranteed to be 22.
The CurImagePlugin selects the largest cursor image from the file. The largest cursor does not have to be at the front of the file. So the start of the DIB header file varies depending on the file.
The fix below initializes a parameter in the CurImagePlugin (if it is in fact a .cur file) so that transparency is considered. It might be worth modifying CurImagePlugin to work similarly to IcoImagePlugin however. I'm looking into that right now, but this is a simple fix.