Code: Select all
nconvert -quiet -out tiff
Moderators: XnTriq, helmut, xnview
Code: Select all
nconvert -quiet -out tiff
secret options!
Code: Select all
nconvert -no_auto_rotate -out tiff
Code: Select all
nconvert -out tiff -no_auto_rotate
Code: Select all
exiftool -all=
Code: Select all
from PIL import Image
import os
def get_image_orientation(image_path):
# Open the image file
with Image.open(image_path) as img:
try:
# Get the EXIF information
exif = img._getexif()
if exif is not None:
# Check for the orientation tag (tag number 0x0112)
if 0x0112 in exif:
orientation = exif[0x0112]
# Rotate the image based on the orientation
if orientation == 3:
img = img.rotate(180, expand=True)
elif orientation == 6:
img = img.rotate(270, expand=True)
elif orientation == 8:
img = img.rotate(90, expand=True)
# Update the EXIF information with the new orientation
img = img._getexif()
img[0x0112] = 1
# Save the rotated image
img.save(image_path)
return "Normal"
except AttributeError:
pass
# If orientation information is not available or invalid, return None
return None
def scan_directory(directory_path):
# Iterate over all files in the directory
for filename in os.listdir(directory_path):
file_path = os.path.join(directory_path, filename)
# Check if the file is an image
if os.path.isfile(file_path) and is_image_file(filename):
# Check the image orientation
orientation = get_image_orientation(file_path)
if orientation is None:
continue #print(f"{filename}: not rotated (orientation information not available)")
elif orientation == "Normal":
continue #print(f"{filename}: not rotated")
else:
print(f"{filename}: rotated")
def is_image_file(filename):
# Check if the file extension corresponds to an image format
image_extensions = [".jpg", ".jpeg", ".png", ".gif", ".bmp"]
return any(filename.lower().endswith(ext) for ext in image_extensions)
# Provide the path to the directory you want to scan
directory_path = "path/to/directory"
scan_directory(directory_path)