Command Line convert DDS to DXT1/DXT5 specifically

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Pekempy
Posts: 2
Joined: 2019-07-26T06:29:43-07:00
Authentication code: 1152

Command Line convert DDS to DXT1/DXT5 specifically

Post by Pekempy »

Hi, I'm using a tool which uses Imagemagick to convert from jpg/png etc to DDS. Some images need to be DXT1 and some need to be DXT5. The main need is DXT1 as this is for the main images.

In the help files it states that occasionally ImageMagick uses DXT5 even if DXT1 is specified using command line args.

Is there a way to ensure DXT1 is used for certain conversions and DXT5 is used otherwise?

Command I'm using is:

Code: Select all

convert -format dds -define dd:mipmaps=1 -define dds:compression=DXT1 'input_file.xxx' 'output_file.dds'
Last edited by Pekempy on 2019-07-26T08:57:39-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Command Line convert DDS to DTX1/DTX5 specifically

Post by fmw42 »

From the format page at https://imagemagick.org/script/formats.php
DDS RW Microsoft Direct Draw Surface Use -define to specify the compression (e.g. -define dds:compression={dxt1, dxt5, none}). Other defines include dds:cluster-fit={true,false}, dds:weight-by-alpha={true,false}, dds:fast-mipmaps={true,false}, and use dds:mipmaps to set the number of mipmaps (use fromlist to use the image list).
Have you tried

Code: Select all

-define dds:compression=dxt1
Pekempy
Posts: 2
Joined: 2019-07-26T06:29:43-07:00
Authentication code: 1152

Re: Command Line convert DDS to DXT1/DXT5 specifically

Post by Pekempy »

Hey,

I do have that in the original command we're using, but the only difference appears to be the lowercase dxt? is that important? so DXT1 wouldn't be the same as dxt1?

Could this be why when we check they're not always compressing correctly?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Command Line convert DDS to DXT1/DXT5 specifically

Post by fmw42 »

I doubt it, but it is easy to check. Just try the lower case and see if it works.

Otherwise, perhaps a bug.

Try rearranging to proper syntax order

Code: Select all

convert  'input_file.xxx' -define dd:mipmaps=1 -define dds:compression=dtx1 'DDS:output_file.dds'
Post Reply