SETLOCAL ENABLEDELAYEDEXPANSION
for %%i in (*.exr) do (
set z=%%i
magick %%i !z:exr=pfm!
)
I have this batch script that i need to be able to run in python without having and calling the external batch file. Im trying to figure out how i can run this same script just on command line so i can us subprocess to do something like:
cmd = '''
SETLOCAL ENABLEDELAYEDEXPANSION
for %i in (*.exr) do (
set z=%i
magick %i !z:exr=pfm!
)
'''
subprocess.check_output(cmd, shell=True, cwd = convdir)
but cannot get it to work. What is the best method to go about this?
I think you are trying to make PFM versions of EXR files. You can get rid of all that Microsoft BATCH nonsense and just do it with ImageMagick .
So, to convert IMAGE.EXR to IMAGE.PFM, just use:
magick mogrify -format PFM IMAGE.EXR
Or, alternatively, if you have a whole directory of EXR files and you want them all converted to PFM:
magick mogrify -format PFM *.EXR
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.