summaryrefslogtreecommitdiff
path: root/OASIS/docs/convert.py
blob: a2100880d6067247ffc4d3e32c288285888eee10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import subprocess
import os

# path to the folder containing the images
folder_path = "/mnt/c/Users/eric/Desktop/FSEG/DPOS/"

# loop through all files in the folder
for filename in os.listdir(folder_path):
    # check if the file is a .gif image
	# construct the full path to the image file
	image_path = os.path.join(folder_path, filename)
	
	# construct the new file name, replacing .gif with .jpg
	new_filename = os.path.splitext(filename)[0] + ".jpg"
	new_image_path = os.path.join(folder_path, new_filename)
	
	# call the convert command from ImageMagick
	subprocess.run(["convert", image_path, new_image_path])