def open(self, image_filename, info_filename): from PASKIL import allskyImage """ Returns an allskyImage object containing the image data and image metadata contained in 'image_filename'. """ image = Image.open(image_filename) exif_data = misc.readExifData(image_filename) info_str = exif_data.pop("Exif.Photo.UserComment") info = eval(info_str) info["exif"] = exif_data # return new allskyImage object return allskyImage.allskyImage(image, image.filename, info)
def test(self, image_filename, info_filename): """ Returns true if 'image_filename' is in the PASKIL JPEG format, false otherwise. """ # check exif # exif = pyexiv2.Metadata(image_filename) exif_data = misc.readExifData(image_filename) # exif.read() try: if exif_data["Exif.Image.ProcessingSoftware"] == "PASKIL": return True else: return False except: return False
def open(self, image_filename, info_filename): """ Returns a PASKIL allskyImage object containing the image data and its associated meta-data. """ image = Image.open(image_filename) with open(info_filename, "rb") as fp: info = pickle.load(fp) # attempt to load the exif data try: info['exif'] = misc.readExifData(image_filename) except: print("Couldn't read the exif") pass # return new allskyImage object return allskyImage.allskyImage(image, image.filename, info)