Page 1 of 1

Problem with .DDS Files

Posted: 2008-07-17T08:22:43-07:00
by Caliginous
Hello,

I'm trying to read in some DDS files to do some comparisons on them, and I'm running into some trouble. If I try something as simple as:

Code: Select all

identify -format '%k' DefaultNormal_256x256.dds
I get the error:

Code: Select all

identify: Improper image header 'DefaultNormal_256x256.dds'.
The image in question can be found here: http://www.gamers-fix.com/DefaultNormal_256x256.zip

I'm using ImageMagick version 6.4.2 07/13/08 Q16 on Windows XP Pro SP1, DLL distribution.

Thanks!

Re: Problem with .DDS Files

Posted: 2008-07-17T09:07:21-07:00
by Bonzo
I do not think dds files are supported by Imagemagick. See:
http://www.imagemagick.org/script/formats.php

Re: Problem with .DDS Files

Posted: 2008-07-17T10:08:11-07:00
by Caliginous
From: http://www.imagemagick.org/script/changelog.php

<clip>
2008-02-29 6.3.9-2 Cristy <quetzlzacatenango@image...>
* Add support for the Postable Document Archive Format.
* Add support for Braille images.
* Add support for DDS images (contributed by Bianca van Schaik).
* Add GetImageAlphaChannel() method.
* PSD clipping paths are once again recognized.
</clip>

The changelog as well as some other posts on the forum suggest that ImageMagick is capable of reading DDS files...
Perhaps it is broken?

Re: Problem with .DDS Files

Posted: 2008-07-17T10:35:39-07:00
by Bonzo
Looks like the documentation is a bit behind.

I can not open the image with 6.4.0 so there may be a problem. It opens OK with GIMP after I installed a plugin.

Re: Problem with .DDS Files

Posted: 2008-07-17T10:49:02-07:00
by Caliginous
I just downloaded the source to try building from source and debugging it, and nt-base.c is all kinds of broken. Two symbols that are unknown (magick_off_t and MAP_ANON), as well as some syntax errors (. in a variable declaration list).

I think I have hacked around the compile errors, but even the compiled code has the same problem. I'm trying to step through the code now to see why it might be falling down.

Re: Problem with .DDS Files

Posted: 2008-07-17T10:58:11-07:00
by Caliginous
Ok, stepping into the code, the DDSD_CAPS flag isn't set on my image's flags, and the DDS reader expects it to be set. I'm not exactly sure why the reader needs it, nor am I sure how I go about getting the flag set on my image.

Re: Problem with .DDS Files

Posted: 2008-07-17T11:02:30-07:00
by Caliginous
Ok, I commented out the check against the DDSD_CAPS flag, and now ImageMagick can read my DDS file.

The change I made is here:

Was:

Code: Select all

	/* Check required flags */
	required = (unsigned long) (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT);
  if ((dds_info->flags & required) != required)
		return MagickFalse;
Now:

Code: Select all

	/* Check required flags */
	required = (unsigned long) (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT);
  if ((dds_info->flags & required) != required)
		return MagickFalse;
I'm not entirely sure why the CAPs structure was being looked for, as from what I can tell, the code manages just fine if the flag isn't set (and the structure isn't there).