Page 1 of 1
conversion from DDS failed
Posted: 2014-07-04T02:42:32-07:00
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.
Re: conversion from DDS failed
Posted: 2014-07-04T07:30:14-07:00
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.
Re: conversion from DDS failed
Posted: 2014-07-05T02:56:47-07:00
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.
Re: conversion from DDS failed
Posted: 2014-07-05T03:47:01-07:00
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?
Re: conversion from DDS failed
Posted: 2014-07-05T14:15:15-07:00
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).
Re: conversion from DDS failed
Posted: 2014-07-06T02:46:38-07:00
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?
Re: conversion from DDS failed
Posted: 2014-07-06T12:00:37-07:00
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).
Re: conversion from DDS failed
Posted: 2014-07-06T13:40:14-07:00
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.
Re: conversion from DDS failed
Posted: 2014-09-06T10:28:45-07:00
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.
Re: conversion from DDS failed
Posted: 2014-09-06T12:35:53-07:00
by dlemstra
The error message is correct, your file has an invalid header. It should start with '4444 5320 7c' (hex).
Re: conversion from DDS failed
Posted: 2014-09-06T12:55:35-07:00
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!
Re: conversion from DDS failed
Posted: 2014-09-06T14:51:58-07:00
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)