conversion from DDS failed

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jbw
Posts: 4
Joined: 2014-07-04T02:01:08-07:00
Authentication code: 6789

conversion from DDS failed

Post by jbw »

system: openSUSE 12.3
software: ImageMagick-6.7.8.8-4.13.1.x86_64
command: convert save02.dds save02.png
response: convert: unexpected end-of-file `save02.dds': No such file or directory @ error/dds.c/ReadDDSImage/403.
source: http://www.jbw.pl/file/magick/save02.dds
result: http://www.jbw.pl/file/magick/save02.png

The source file can be viewed well in IrfanView and GIMP, but ImageMagick cannot process it.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: conversion from DDS failed

Post by snibgo »

With IM 6.9.9-0 on Windows 8.1, I also get "convert: unexpected end-of-file `save02.dds'".

However, Gimp 2.8.10 can't open save02.dds.

A developer would need to take a look.
snibgo's IM pages: im.snibgo.com
jbw
Posts: 4
Joined: 2014-07-04T02:01:08-07:00
Authentication code: 6789

Re: conversion from DDS failed

Post by jbw »

snibgo wrote:However, Gimp 2.8.10 can't open save02.dds
I forget to mention: my GIMP is armed with excellent DDS plugin by Shawn Kirst.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: conversion from DDS failed

Post by dlemstra »

16 bit uncompressed dds files are not yet supported by ImageMagick. But instead of raising a warning for that it treats the input as 32 bit which will result in the image you are seeing. Can you post a link to the result from GIMP?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
jbw
Posts: 4
Joined: 2014-07-04T02:01:08-07:00
Authentication code: 6789

Re: conversion from DDS failed

Post by jbw »

dlemstra wrote:Can you post a link to the result from GIMP?
There is no single thing like "result from GIMP". DDS plugin reads the file into the GIMP's buffer and it is automatically kept as a 32-bit image despite the 16-bit source. Next, we can export it in any format we wish, including (but not limited to) DDS. In the case of DDS we have plenty of pixel formats to choose (see http://www.jbw.pl/file/magick/ddsformats.jpg). Selecting "default" which means 32-bit, we have regular DDS, which can be converted with IM without troubles (see http://www.jbw.pl/file/magick/save02t.dds and http://www.jbw.pl/file/magick/save02t.png).
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: conversion from DDS failed

Post by dlemstra »

I am sorry for the poor phrasing but I just wanted to see how the image looked like. I am working on adding support for the R5G6B5 and RGBA4 and RGB5A1 format but I was getting an incorrect output image. With the help of your image I figured out what I was doing wrong. Can you do me a favor and also provide me with an RGBA4 and RGB5A1 dds file that I can use to test my code?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
jbw
Posts: 4
Joined: 2014-07-04T02:01:08-07:00
Authentication code: 6789

Re: conversion from DDS failed

Post by jbw »

dlemstra wrote:provide me with an RGBA4 and RGB5A1 dds file
Files http://www.jbw.pl/file/magick/save02-RGBA4.dds and http://www.jbw.pl/file/magick/save02-RGB5A1.dds was exported from GIMP (more precisely, with DDS output plugin by Shawn Kirst).
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: conversion from DDS failed

Post by dlemstra »

Thank you for posting those image. The next version of ImageMagick (6.8.9.6) will include support for reading B5G6R5/B5G5R5A1/B4G4R4A4 dds files.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
niv
Posts: 3
Joined: 2014-09-06T10:24:37-07:00
Authentication code: 6789

Re: conversion from DDS failed

Post by niv »

Hi,

Sorry for hijacking this thread!

I'm seeing conversion issues as well, using the latest imagemagick version available in homebrew (6.8.9-7). I'm trying to convert DDS files as used by a older game, probably created with the NIVIDA dds photoshop plugin (don't have it though, so I can't check what exactly is "wrong" with it).

Example file.

identify output:

Code: Select all

improper image header `/path/file.dds` @ error/dds.c/ReadDDSImage/1730.
Not sure why that dds file would be invalid.

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

Re: conversion from DDS failed

Post by dlemstra »

The error message is correct, your file has an invalid header. It should start with '4444 5320 7c' (hex).
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
niv
Posts: 3
Joined: 2014-09-06T10:24:37-07:00
Authentication code: 6789

Re: conversion from DDS failed

Post by niv »

Heh. You're right, I guess.

Apparently, Bioware used a custom file format that is called .dds, but isn't actually .dds ..

Never mind then. Thanks!
niv
Posts: 3
Joined: 2014-09-06T10:24:37-07:00
Authentication code: 6789

Re: conversion from DDS failed

Post by niv »

Apparently, the format Bioware used is standard DXT5 (google tells me), but with a custom, terser header.

I'm not sure how to parse it though.

This is what I've got:

Code: Select all

data.unpack("I I I I f")
=> [64, 64, 4, 4096, 1.0]
The first 4 DWORDs are size_x, size_y, bpp(?) and data_size (I assume - 64x64), and a float of which I have no idea what it means. After that, random binary data follows which I assume is DXT5 data, but it looks different for some files - sometimes with huge blobs of nullbytes (complete black?).

I've tried copying the default header from a different DDS file (128 bytes, with magic bytes), filling in those fields at the appropriate places (referencing msdn), but it doesn't really work.

Specifically, the header passes but imagemagick tells me it's ran out of image data bytes to read.

My guess is I'm having trouble understanding where exactly DDS data begins and how it looks like in hex, and what fields the DDS header needs to have set for that to work.

Can someone with some DDS experience help me out here? Just a quick look at my source files and some pointers/guidance would be hugely appreciated.

Here's a few files with different contents:

https://dl.dropboxusercontent.com/u/168 ... c13_01.dds
https://dl.dropboxusercontent.com/u/168 ... D02_01.dds
https://dl.dropboxusercontent.com/u/168 ... g08_01.dds

In any case, TYVM! (ps: imagemagick rocks)
Post Reply