Page 1 of 1

Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T13:16:46-07:00
by Jeff0
Hi,
I am trying to find a way to convert .DDS files to .PNG, and .PNG to .DDS, while keeping all the channels such as alpha, mipmaps and normalmaps intact.
Does anyone know of a few scripts I could use? I am using Windows 10.

Edit: I thought about doing this:

Code: Select all

convert image1.dds image1.png
But is this the right way to do it? I'd love to hear your suggestions.

Re: Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T13:47:48-07:00
by fmw42
I am not an expert on DDD. See the defines for DDS at https://imagemagick.org/script/formats.php and https://imagemagick.org/script/command- ... php#define, which include those for mipmaps.

Re: Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T14:13:05-07:00
by Jeff0
fmw42 wrote: 2019-02-27T13:47:48-07:00 I am not an expert on DDD. See the defines for DDS at https://imagemagick.org/script/formats.php and https://imagemagick.org/script/command- ... php#define, which include those for mipmaps.
Thanks for the reply, I was wondering if you could help me also with a script that scans sub-directories, converts the images, copies the folder structure, and moves it to another folder. E.g, if you have the structure:

Code: Select all

C:\Images\Pictures\ImageFolder\images2***.dds ("images2***.dds" inside "ImageFolder")
             |
             |                                  
             ↓
        images1***.dds ("images1***.dds" Inside "Pictures")
I want to move all the converted .dds to png files after conversion to

Code: Select all

C:\Converted_Images\Images\Pictures(images1***.png)\ImageFolder\(image2***.png)
If you could help me with that that would be great

Re: Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T15:10:28-07:00
by fmw42
Sorry, I do not code on Windows. But others on this forum do and likely can help you.

Re: Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T15:18:46-07:00
by Jeff0
fmw42 wrote: 2019-02-27T15:10:28-07:00 Sorry, I do not code on Windows. But others on this forum do and likely can help you.
Ok, thanks for your help anyway

Re: Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T15:36:02-07:00
by snibgo
What version of IM? I'll assume v7.
@Jeff0: You seem to have two questions. One is about converting a dds file to png. I know nothing about dds files, but ...

Code: Select all

magick in.dds out.png
... would be a good start.

Your second question is about creating the png file in a different directory. This would be:

Code: Select all

magick inpath\in.dds outpath\out.png
If you have multiple files in multiple directories, you could use a "for" loop for the files and directories, running "magick" for each file. Another possibility is a "for" loop for directories only and "magick mogrify" for each directory. Or "forfiles" for the loop.

Re: Help with finding two scripts to convert .DDS to PNG and back

Posted: 2019-02-27T16:26:53-07:00
by Jeff0
@snibgo thanks for the tip, I'll be sure to look into it.