Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any way to export a lot of pictures from *.jpg to *.dds
#1
Hi. I'm trying to do something that seems pretty simple, but I'm not sure if it's possible to do in GIMP at all, but I really hope so.

I have an image "file.jpg". I open it with GIMP, then I go to "File", then "Export As...", I choose "DDS image" (there're two ones, I select the first one, I don't know if/how they differ from each other). Then I use the settiongs (I choose the compression - BC1/DXT1, other options are default):
[Image: YVoUTMfS]
(Sorry, my picture isn't vissible. It's on https://imgbox.com/YVoUTMfS)
After exporting I get "file.dds" picture.

So, I have a directory which contains several subdirectories each of which contains several *.jpg pictures similar to "file.jpg" (all picture are 512x512, but I think it doesn't matter). All what I need is to export all these *.jpg images to *.dds format ang get the results the same as if they were received if I exported them manually one by one as I've written above. The all exported *.dds file should have names the same as its input *.jpg files. Also, it would be nice to delete all input *.jpg files after conversion.

 I've seen some scripts for GIMP, but they look pretty difficult for me, I've never used GIMP before. Maybe there's a simple way to do it in Windows command-line CMD. (Also, I could make such conversion on Linux if it will be easier, than on Windows, although my laptop with Linux isn't so powerful). Also, I've installed BIMP and tried the "Batch Image Manipulation Plugin", but I havent found the *.dds format for exporting...
Reply
#2
You can use xnconvert for jpg to DDS batch conversion (freeware) :
https://www.xnview.com/en/xnconvert/
Reply
#3
(06-10-2024, 05:20 PM)denzjos Wrote: You can use xnconvert for jpg to DDS batch conversion (freeware) :
https://www.xnview.com/en/xnconvert/

Thanks. I've installed that and converted my JPG to DDS. The only thing is that I get the DDS image which has the size 256 KB, whereas converting the same JPG image using GIMP (or Photoshot) gives the DDS image of size 128 KB. It's a problem, since I have many such DDS images, so I'm losing half of my disk space. I don't see any parameters for the output DDS file in XnConvert.
Reply
#4
The output *.dds picture has the DXT5 compression, whereas I need the DXT1 one. It could explain such large size.
Reply
#5
Try this one : https://www.ddsconverter.com
Reply
#6
(06-11-2024, 06:29 AM)denzjos Wrote: Try this one : https://www.ddsconverter.com

The description and program screenshot say that it only converts from DDS to several other formats, whereas I need to convert from JPG to DDS.
Reply
#7
Just a note about BIMP. The code does contain reserved words, such as save so you will not find file_save_dds in the BIMP PDB listing. A common workaround is put the command in a simple script/plugin wrapper and call that from BIMP (the GIMP other procedure option).

I tried always yesterday and while said simple (python) plugin works on its own, when used in BIMP it just outputs the input jpeg file. If you can write a script-fu scm then you stand more chance using the Gimp batch format.
see: https://www.gimp.org/tutorials/Basic_Batch

Probably easier, off the peg, is command line ImageMagick (IM)
An example here: https://imagemagick.org/discourse-server...hp?t=36440
You would need to wrap that command up in a Windows batch file. Worth asking on the IM forum https://github.com/ImageMagick/ImageMagick/discussions
Reply
#8
Thanks, I've tried ImageMagick a lot before started this thread. The problem with IM is that it converts my JPG to DDS differently than GIMP.

For now XnConvert is the best way, but it gives DXT5 compression instead of DXT1 for a DDS.
Reply
#9
(06-11-2024, 12:24 PM)misha.physics Wrote: Thanks, I've tried ImageMagick a lot before started this thread. The problem with IM is that it converts my JPG to

DDS differently than GIMP.

For now XnConvert is the best way, but it gives DXT5 compression instead of DXT1 for a DDS.

It is a shame that IM does not give a result.

For a DXT1 format then back to Gimp, and BIMP but it is hedged with ifs and buts...
This is the "shell" plugin I use with BIMP, I am no coder so it is very basic.
Unzip the attached and put for_bimp.py in your plugins folder
Starting BIMP it looks like this:

   

(1) Is the folder of jpg's
(2) The is the "Other Gimp procedure" option when you click on "Add" 
(3) Search for bimp and Ok it.
(4) Set a "scrap" folder. BIMP will write jpegs there regardless. You can clean up afterwards.

Now for the if-n-buts
The plugin will write .dds files in DXT1 format but the filename is in the form name.jpg.dds Easy for me in linux to bulk rename and get rid of the .jpg bit. I do not know about Windows.
The plugin writes the .dds files to your User folder C:\Users\your_id\   Recover them from there.  Very tedious but maybe better than one-at-a-time

If you want to change the parameters, then look up file_dds_save in Help -> Procedure browser and compare with the line in the plugin.
Code:
db.file_dds_save (timg, tdrawable, outname, outname, 1, 0,0,0,0,0,0,0,0,2.2,0,0,127.0)


Attached Files
.zip   for-bimp.zip (Size: 425 bytes / Downloads: 129)
Reply
#10
Thank you for this. It looks difficult, but it's a way for trying. By the way I'm using Linux (Mint) as well.
Reply


Forum Jump: