Skip to content

Conversation

@jlwoolf
Copy link

@jlwoolf jlwoolf commented Sep 21, 2022

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.

@jlwoolf
Copy link
Author

jlwoolf commented Sep 22, 2022

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.

@radarhere radarhere changed the title The BmpImagePlugin did not work with all .cur files BmpImagePlugin does not work with all .cur files Sep 22, 2022
@jlwoolf jlwoolf changed the title BmpImagePlugin does not work with all .cur files Expanded .ani and .cur functionality Sep 23, 2022
@jlwoolf
Copy link
Author

jlwoolf commented Sep 23, 2022

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 radarhere changed the title Expanded .ani and .cur functionality Expand .ani and .cur functionality Apr 20, 2025
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

Successfully merging this pull request may close these issues.

3 participants