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

Add DDS saving #5402

Merged
merged 4 commits into from Jun 28, 2021
Merged

Add DDS saving #5402

merged 4 commits into from Jun 28, 2021

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Apr 12, 2021

Helps #4864 by adding DDS saving. https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dds-header was used as a reference.

Also, a minor cleanup change. Uses this existing line

DDPF_RGB = 0x40

to make
if pfflags & 0x40:
# DDPF_RGB - Texture contains uncompressed RGB data

clearer.

if pfflags & DDPF_RGB:
    # Texture contains uncompressed RGB data

@radarhere radarhere changed the title Use constant for DDS uncompressed RGB data check Add RGB DDS saving Apr 12, 2021
@radarhere radarhere changed the title Add RGB DDS saving Add DDS saving Apr 13, 2021
@radarhere
Copy link
Member Author

I've pushed another commit for RGBA saving.

While you would look at the spec and conclude that you should be able to specify the order of the channels arbitrarily using the bit masks, checking the results with ImageMagick I didn't find this to work. Instead, I've swapped the RGBA channels before saving so that it becomes ARGB, the example for the bit masks - https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dds-pixelformat.

@hugovk hugovk merged commit d0394d4 into python-pillow:master Jun 28, 2021
@hugovk hugovk mentioned this pull request Jun 28, 2021
23 tasks
@radarhere radarhere deleted the dds branch June 28, 2021 22:57
radarhere added a commit to radarhere/Pillow that referenced this pull request Jun 30, 2021
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.

None yet

2 participants