Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.project
.pydevproject
11 changes: 9 additions & 2 deletions image_metadata_randomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
import sys
import argparse
import glob
import string

def randomize_metadata(image_path, randomize_all=True, randomize_windows_props=True):
# Get the directory and filename from the input path
directory = os.path.dirname(image_path)
filename = os.path.basename(image_path)
# Create output path in the same directory but with "modified_" prefix
output_path = os.path.join(directory, f"modified_{filename}")
output_path = os.path.join(directory, generate_random_filename())

try:
# Open the image
Expand Down Expand Up @@ -270,6 +271,12 @@ def convert_to_dms(coordinate):
except Exception as e:
print(f"Error processing image: {e}")
return None

def generate_random_filename():
characters = string.ascii_letters + string.digits
length = random.randint(10, 53)
filename = ''.join(random.choices(characters, k=length)) + '.jpg'
return filename

def get_metadata_string(image_path):
"""Reads EXIF data from an image and returns it as a formatted string."""
Expand Down Expand Up @@ -448,7 +455,7 @@ def main():
image_paths.extend(glob.glob(os.path.join(args.folder, '*.jpeg')))

if not image_paths:
print(f"No jpg/jpeg files found in folder '{args.folder}'")
print(f"No jpg/jpeg/png files found in folder '{args.folder}'")
return

print(f"Found {len(image_paths)} images in folder '{args.folder}'")
Expand Down