Skip to content

Apply XOR mask to 1 and L mode CUR images#9641

Open
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:cur
Open

Apply XOR mask to 1 and L mode CUR images#9641
radarhere wants to merge 1 commit into
python-pillow:mainfrom
radarhere:cur

Conversation

@radarhere
Copy link
Copy Markdown
Member

@radarhere radarhere commented May 30, 2026

Resolves #9637

Since PIL, CUR images have had their height halved.

# patch up the bitmap height
self._size = self.size[0], self.size[1] // 2

This is because https://en.wikipedia.org/wiki/ICO_(file_format)#File_structure

An ICO or CUR file
...
Images with less than 32 bits of color depth follow a particular format: the image is encoded as a single image consisting of a color mask (the "XOR mask") together with an opacity mask (the "AND mask").

This PR applies the XOR mask to 1 and L mode images.

@radarhere radarhere changed the title Apply AND mask to 1 and L mode CUR images Apply XOR mask to 1 and L mode CUR images May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cur file saved as a png has black pixels where it needs to be transparent

1 participant