Page 1 of 1

Mogrify: DDS Image Type Not Supported

Posted: 2014-08-31T15:48:55-07:00
by fireundubh
I encountered these errors while running mogrify on 12 GB of DDS textures. I don't know how to troubleshoot these errors. They apparently refer to line numbers in dds.c.

Code: Select all

C:\Games\ModOrganizer\mods\SMC\Textures>dds21k
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\dlc01\effects\darkswirlsalpha.dds' @ error/dds.c/ReadUncompressedRGBA/2252.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelarrow_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelbattleaxe_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelbow_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelclaymore_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steeldagger_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelmace_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelscabbards_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelsword_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelwaraxe_m.dds' @ error/dds.c/ReadDDSImage/1796.
mogrify.exe: image type not supported `\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel\steelwarhammer_m.dds' @ error/dds.c/ReadDDSImage/1796.
dds21k.bat:

Code: Select all

@echo off
FOR /F "delims=" %%i IN ('dir /a-d/s/b *.dds') DO (mogrify -resize 1024x^> "%%~pni.dds")

Re: Mogrify: DDS Image Type Not Supported

Posted: 2014-08-31T16:24:26-07:00
by fmw42
What version of IM are you using? I presume from your coding that you are using Windows as the platform.

Does it work using convert on a single image?

Re: Mogrify: DDS Image Type Not Supported

Posted: 2014-08-31T16:43:01-07:00
by fireundubh
ImageMagick-6.8.9-Q16 (Windows 7)

Code: Select all

C:\Games\ModOrganizer\mods\SMC\Textures\weapons\Steel>convert steelarrow_m.dds -resize 1024x^> steelarrow_m_1024.dds
convert.exe: image type not supported `steelarrow_m.dds' @ error/dds.c/ReadDDSImage/1796.
convert.exe: no images defined `steelarrow_m_1024.dds' @ error/convert.c/ConvertImageCommand/3187.
I can load the image in Photoshop with no problems.

Here's two of the DDS files that produce the different errors:

Re: Mogrify: DDS Image Type Not Supported

Posted: 2014-08-31T21:33:36-07:00
by fmw42
It works fine for me with a DDS image with no alpha.

Using convert on your images, I get your same error.

Code: Select all

convert darkswirlsalpha.dds darkswirlsalpha2.dds
convert: image type not supported `darkswirlsalpha.dds' @ error/dds.c/ReadUncompressedRGBA/2252.

But I can do the following fine.

Code: Select all

convert logo: -transparent white logo.dds
convert logo.dds -resize 50% logo2.dds
So I think it must have to do with your particular images. Perhaps they are malformed in some way.

Using identify on your image gives an error message.

identify: unexpected end-of-file `darkswirlsalpha2.dds': Bad file descriptor @ error/dds.c/ReadDDSImage/1850.


This may be the source of the problem.

Re: Mogrify: DDS Image Type Not Supported

Posted: 2014-08-31T23:30:20-07:00
by fireundubh
You ran identify on darkswirlsalpha2.dds, which was created despite the convert failure. If you check the file size, you'll see that convert produced a junk file.

I received this output when I ran identify on the original darkswirlsalpha.dds:

Code: Select all

C:\SMC\test>identify darkswirlsalpha.dds
darkswirlsalpha.dds DDS 512x512 512x512+0+0 8-bit sRGB 128B 0.000u 0:00.000
The file will not convert, however, as you found.

Code: Select all

C:\SMC\test>convert darkswirlsalpha.dds darkswirlsalpha2.dds
convert.exe: image type not supported `darkswirlsalpha.dds' @ error/dds.c/ReadUncompressedRGBA/2252.
Also, I can open each of those "not supported" images in Photoshop (with NVIDIA Texture Tools) without any problems. If there was file corruption, Photoshop, Gimp, etc., would throw an error.

IM appears to lack support for some DDS formats.

darkswirlsalpha.dds: 16-bit A8R8G8B8
steelarrow_m.dds: 8-bit L8

I'd retrieve the format of steelarrow.dds, which was successfully identified and converted, but NVIDIA's Windows Texture Viewer crashes when trying to open that file...

edit: I decided to take a look at the dds.c source code.

This is where IM is failing on darkswirlsalpha.dds:

Code: Select all

2243  alphaBits=0;
2244  if (dds_info->pixelformat.rgb_bitcount == 16)
2245    {
2246      if (IsBitMask(dds_info->pixelformat,0x7c00,0x03e0,0x001f,0x8000))
2247        alphaBits=1;
2248      else if (IsBitMask(dds_info->pixelformat,0x0f00,0x00f0,0x000f,0xf000))
2249        alphaBits=4;
2250      else
2251        ThrowBinaryException(CorruptImageError,"ImageTypeNotSupported",
2252          image->filename);
2253    }
This seems to indicate that darkswirlsalpha.dds has neither 1 alpha bit nor 4 alpha bits.

And this is where IM is failing on steelarrow_m.dds:

Code: Select all

1744  if (dds_info.pixelformat.flags & DDPF_RGB)
1745    {
          [...]
1757    }
1758  else if (dds_info.pixelformat.flags & DDPF_FOURCC)
1759    {
          [...]
1792    }
1793  else
1794    {
1795      /* Neither compressed nor uncompressed... thus unsupported */
1796      ThrowReaderException(CorruptImageError, "ImageTypeNotSupported");
1797    }
I don't think that comment is accurate though.

DDPF_RGB is 0x00000040. DDPF_FOURCC is 0x00000004.

IM isn't finding those flags in steelarrow_m.dds. Maybe IM isn't finding the right flags in darkswirlsalpha.dds, too.

edit: I checked out both files in a hex editor.

Looking at the DDS_PIXELFORMAT structure, I think IM does not have legacy DDS support.