Menu

How to apply xBRZ to entire folder of pictures (Batch?)

Rodger Roe
2016-02-25
2020-09-08
  • Rodger Roe

    Rodger Roe - 2016-02-25

    Hi Zenju, thanks for the xBRZ filter. How can I apply xBRZ to a folder that is full of pictures? I believe it is called batching.

     
  • Zenju

    Zenju - 2016-02-25

    The ScalerTest tool currently doesn't have command line support.

     
  • Bighead

    Bighead - 2016-05-17

    Hey Zenju was wondering if you have any interest in implementing command line support? To my knowledge, there isn't a Windows program that exists that can apply xBRZ to images through command line. This could beneift at least the Dolphin texture pack community, there are some users manually using your tool to upscale game textures, 100's to even 1000's of images. With command line support I could automate it for them, as I've recieved requests to somehow add xBRZ to my powershell script here: https://forums.dolphin-emu.org/Thread-unofficial-custom-texture-tool-ps-v7-3

     
  • Zenju

    Zenju - 2016-05-20

    Okay, I've added command line support.

     
  • Bighead

    Bighead - 2016-05-20

    Awesome! Is there somewhere that lists the arguments (like xBRZ strength) and how to specify an output? I tried a few by guessing....
    ScalerTest.exe input.png output.png
    ScalerTest.exe -xbrz 6x input.png output.png

    .. but it just loaded the program with "input.png" in the input file section

     
  • Zenju

    Zenju - 2016-05-20

    You could have tried "ScalerTest.exe -h", "ScalerTest.exe /?" or the like :)

     
  • Bighead

    Bighead - 2016-05-21

    Not sure why I didn't think of that. :P Anyway, it works perfect! Many thanks!

     
  • Rodger Roe

    Rodger Roe - 2016-05-21

    Thanks Zenju for the command line support. I have a question. What command do I use to apply xBRZ to a folder and have the output be a different folder?

     
    • Zenju

      Zenju - 2016-05-21

      This can be solved via ordinary batch scripting, look for the "for /r" command

       
      • Rodger Roe

        Rodger Roe - 2016-05-21

        I'm stuck Zenju. So if i have my pictures in this path:

        C:\Users\username\Desktop\Gallery 1

        And I wanted to apply -4xBRZ to the folder and send the output pictures to:

        C:\Users\username\Desktop\Gallery 2

        How should it look like with the "for/r" command?

        Thanks.

         

        Last edit: Rodger Roe 2016-05-21
        • Rodger Roe

          Rodger Roe - 2016-05-22

          Nevermind. I figured it out.

           
  • Jane Doe

    Jane Doe - 2018-12-31

    Hello, I don't know if you are still reading these but. I would like to know how to "batch" image processing as well... Like the user above, sadly I have not figured out how. I am terrible at cmd line.

     
    • Zenju

      Zenju - 2018-12-31

      To scale all PNG files in the current directory, put the following inside a CMD file and run it:

      for /R . %%F in (*.png) do ScalerTest.exe -6xBRZ "%%F" "%%~nF.6xBRZ.png"
      
       
      • Jane Doe

        Jane Doe - 2018-12-31

        Thank you very much!

         
      • Jane Doe

        Jane Doe - 2018-12-31

        Well, I tried it, if I just throw that line in the command window it says "%%F" was unexpected. If I run it with the exe, it throws an error that reads "incorrect number of paths specified"

         
        • Zenju

          Zenju - 2019-01-01

          put the following inside a CMD file

           
      • oneilmw

        oneilmw - 2019-11-16

        What if I want to do a whole directory tree? Currently, the CMD file just spits out all the images into its own directory. How can I get it to preserve the directory structure of the images and spit everything out into a new directory with the old filenames?
        I am trying to use this to make a minecraft resource pack, and the graphics files there are in a non-trivial directory structure.

         
        • Stanimir Stamenkov

          @echo off
          setlocal enabledelayedexpansion
          
          for /r %%I in (*.png) do (
            set RELDIR=%%~dI%%~pI
            set RELDIR=!RELDIR:%CD%\=!
          
            echo !RELDIR!%%~nI%%~xI
            set DESTDIR=..\output\!RELDIR!
            if not exist "!DESTDIR!" mkdir !DESTDIR!
          
            scalertest -4xbrz "%%I" "!DESTDIR!%%~nI@4x.png"
          )
          
          endlocal
          

          References:

           
          • oneilmw

            oneilmw - 2020-05-28

            Works like a charm. I had to remove the @4x from line 12 to preserve the original filename. I now have:

            @echo off
            setlocal enabledelayedexpansion
            
            for /r %%I in (*.png) do (
              set RELDIR=%%~dI%%~pI
              set RELDIR=!RELDIR:%CD%\=!
            
              echo !RELDIR!%%~nI%%~xI
              set DESTDIR=..\output\!RELDIR!
              if not exist "!DESTDIR!" mkdir !DESTDIR!
            
              scalertest -4xbrz "%%I" "!DESTDIR!%%~nI.png"
            )
            
            endlocal
            
             
  • oneilmw

    oneilmw - 2019-11-16
     

    Last edit: oneilmw 2019-11-16
  • Ronin

    Ronin - 2020-08-10

    So, a bit of a tangent, but I get how to apply xBRZ to an entire folder.
    Since it's running it through ScalerTest.exe, it should be possible to do the same with the other filters (including option to not use a scaler?)

    How would you do this?

    for /R . %%F in (*.png) do ScalerTest.exe -4xBRZ "%%F" "%%~nF.png"
    

    It's safe to say that it involves changing the "-4xBRZ"
    I couldn't get it to work.

     
    • Stanimir Stamenkov

      If you're executing this directly on the command-line you need to relace %%F with %F and %%~nF with %~nF:

      for /R . %F in (*.png) do ScalerTest.exe -4xBRZ "%F" "%~nF.png"
      

      See the documentation references previously posted – FOR /R:

      %%parameter : A replaceable parameter: in a batch file use %%G (on the command line %G)

      Parameter Extensions:

      ... FOR command variables which use a single leading % on the command line or a double leading %% when used in a batch file.

      If you are using the FOR command at the command line rather than in a batch program, use just one percent sign: %G instead of %%G.

       

Log in to post a comment.

MongoDB Logo MongoDB