Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PIL import Image
- from PIL.ExifTags import TAGS
- def get_exif_data(image):
- """Extract EXIF data from the image"""
- try:
- img = Image.open(image)
- exif_data = img._getexif()
- if exif_data is not None:
- exif = {}
- for tag, value in exif_data.items():
- decoded = TAGS.get(tag, tag)
- exif[decoded] = value
- return exif
- else:
- return None
- except:
- return None
- if __name__ == '__main__':
- if len(sys.argv) > 1:
- image = sys.argv[1]
- exif_data = get_exif_data(image)
- if exif_data is not None:
- for key, val in exif_data.items():
- print(f"{key}: {val}")
- else:
- print("No EXIF data found in the image.")
- else:
- print("Usage: python extract_metadata.py <image>")
- #!/data/data/com.termux/files/usr/bin/bash
- echo "Enter the path of the image: "
- read path
- #Extracting metadata
- exiftool $path
- #Reverse image search option
- echo "Would you like to perform a reverse image search? (Y/N)"
- read choice
- if [ "$choice" == "Y" ] || [ "$choice" == "y" ]
- then
- xdg-open "https://www.google.com/searchbyimage?image_url=$(echo $path | sed 's/\//%2F/g' | sed 's/\+/%2B/g')"
- else
- echo "Done"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement