Batch texture converting. How to convert all images in a directory.

2023-07-13 Other tutorials kleskby 0 101
Author: kleskby


Let's say you downloaded a bunch of textures from the internet. Some of them are JPG, some are PNG or even TGA. That is uncomfortable and may cause trouble when importing inside the game. It's good practice to cast all textures to the same format.

To do this, we will need ImageMagick - free open-source software with many pre-build tools. 

  1. Download and install ImageMagick.
  2. Locate ImageMagick binaries on your computer. In my case it is C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\
  3. Press Win + R and type cmd or just simply open Command Prompt form Start menu.
  4. Type
    for /r "YOUR TEXTURE FOLDER" %a in (*.*) do "PATH TO IAMGEMAGICK\magick.exe" mogrify -format FORMAT %a
  5. After you press Enter it will start converting process. It may happen that the textures you download appear flipped after converting. In that case add flag -flip after FORMAT.
    So your final command will look something like this
    for /r "E:\GameDev\TEXTURES" %a in (*.*) do "C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick.exe" mogrify -format png -flip %a
  6. (Optional) To atomize process you may create a bath script. Create an empty text document and type
    for /r "YOUR TEXTURE FOLDER" %%a in (*.*) do "PATH TO IAMGEMAGICK\magick.exe" mogrify -format FORMAT %%a
    Pay attention that now we have double %%. Save it as .bat script.

preview



Tags: Mapping, 2D, Textures
Owned by kleskby#1837
Telegram
Close

You have no new notifications.


You have no new messages.