This commit is contained in:
louiscklaw
2025-01-31 22:57:47 +08:00
parent b1cd1d4662
commit b3cc8e8323
764 changed files with 722101 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import os
import sys
def trim_last_newline(file_path):
with open(file_path, 'r+') as file:
file.seek(0, os.SEEK_END)
file.seek(file.tell() - 1, os.SEEK_SET)
file.truncate()
def process_pos_file(width, height):
with open('pos.txt', 'r') as file:
data = file.read()
data = data.replace('.jpg', '.jpg 1 0 0 {} {}'.format(width, height))
with open('pos.txt', 'w') as file:
file.write(data)
if __name__ == "__main__":
trim_last_newline('neg.txt')
trim_last_newline('pos.txt')
process_pos_file(sys.argv[1], sys.argv[1])