summaryrefslogtreecommitdiff
path: root/OASIS/docs/convert_bmp.py
diff options
context:
space:
mode:
authorEric Dao <eric@erickhangdao.com>2023-05-12 14:09:07 -0400
committerEric Dao <eric@erickhangdao.com>2023-05-12 14:09:07 -0400
commit191e4bd8beae134295d481773823142d2fdc6a98 (patch)
treeaaca4e7f8e229f9bd551d9bb1583b8ecd7a59d4a /OASIS/docs/convert_bmp.py
parent186daed7e179241377c117e9d208ccd301d4d712 (diff)
downloadura-master.tar.gz
ura-master.tar.bz2
ura-master.zip
refactored tool chain setup, able to debug and run from vscode nowHEADmaster
Diffstat (limited to 'OASIS/docs/convert_bmp.py')
-rw-r--r--OASIS/docs/convert_bmp.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/OASIS/docs/convert_bmp.py b/OASIS/docs/convert_bmp.py
new file mode 100644
index 0000000..05de100
--- /dev/null
+++ b/OASIS/docs/convert_bmp.py
@@ -0,0 +1,18 @@
+from PIL import Image
+import os
+
+jpeg_folder = "/mnt/c/Users/eric/Documents/repos/URA/OASIS/JPEG/DPOS"
+bmp_folder = "/mnt/c/Users/eric/Documents/repos/URA/OASIS/BMP/DPOS"
+
+# Create the BMP folder if it doesn't exist
+if not os.path.exists(bmp_folder):
+ os.makedirs(bmp_folder)
+
+# Loop over all the JPEG files in the folder
+for file in os.listdir(jpeg_folder):
+ if file.endswith(".jpg"):
+ # Load the JPEG file and convert it to BMP format
+ jpeg_file = os.path.join(jpeg_folder, file)
+ bmp_file = os.path.join(bmp_folder, os.path.splitext(file)[0] + ".bmp")
+ with Image.open(jpeg_file) as im:
+ im.convert("L").save(bmp_file) \ No newline at end of file