Legacy DDS Support

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Legacy DDS Support

Post by fireundubh »

Per this thread, I discovered that ImageMagick's DDS coder (dds.c) does not have support for legacy DDS files.

Specifically, the DDS_PIXELFORMAT structure allows for three legacy flags that are not handled by the coder:
DDPF_ALPHA (0x2)
Used in some older DDS files for alpha channel only uncompressed data (dwRGBBitCount contains the alpha channel bitcount; dwABitMask contains valid data)

DDPF_YUV (0x200)
Used in some older DDS files for YUV uncompressed data (dwRGBBitCount contains the YUV bit count; dwRBitMask contains the Y mask, dwGBitMask contains the U mask, dwBBitMask contains the V mask)

DDPF_LUMINANCE (0x20000)
Used in some older DDS files for single channel color uncompressed data (dwRGBBitCount contains the luminance channel bit count; dwRBitMask contains the channel mask). Can be combined with DDPF_ALPHAPIXELS for a two channel DDS file.
Without support for these flags, ImageMagick fails to convert legacy DDS files.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Legacy DDS Support

Post by dlemstra »

I will put this on my todo list and try to add support for it.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Legacy DDS Support

Post by dlemstra »

Only the steelarrow_m.dds file is in the legacy format (DDPF_LUMINANCE) and it does not have the DDPF_ALPHA bit set. And the 'darkswirlsalpha.dds' file has an unsupported bit mask. I made some changes to my local development build to add support for both formats and I now get the following output: https://www.dropbox.com/sh/wxd03zif2ysn ... gMTba?dl=0.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Re: Legacy DDS Support

Post by fireundubh »

Hmm, I guess I was reading the DDS header incorrectly.

Your output looks right.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Legacy DDS Support

Post by dlemstra »

Would you be willing to share a larger set of dds images? This will allow me to check the output and maybe add support for images that are unsupported at the moment. Feel free to send me a PM if you don't want to publicly share those images.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Re: Legacy DDS Support

Post by fireundubh »

How many more images do you need? I just get them from here but I can put a package together for you.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Legacy DDS Support

Post by dlemstra »

I need to become a member to download something from that site. I just wanted to check a couple more files. Can you provide me with a link to the 9 other files that failed for you in the other topic?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Re: Legacy DDS Support

Post by fireundubh »

Here's 9 more, but they all produce the same error:

http://www.mediafire.com/download/h58h5 ... steel_m.7z

I'll try to find more in a different texture package.
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Re: Legacy DDS Support

Post by fireundubh »

User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Legacy DDS Support

Post by dlemstra »

I just committed a patch that adds support for all the files you supplied, this will be available in ImageMagick 6.8.9-8.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Re: Legacy DDS Support

Post by fireundubh »

Great news! Thank you. I'm looking forward to the next version.
fireundubh
Posts: 10
Joined: 2014-08-31T15:40:41-07:00
Authentication code: 6789

Re: Legacy DDS Support

Post by fireundubh »

Just installed the new version. Appears to be working! Thank you!
Post Reply