コード例 #1
0
ファイル: Flickr.py プロジェクト: gimlids/whereamio
   def store_medium_and_metadata(self):
      image_dir_path = "data/flickr_mirror/" + self.flickr_locator_path()
      dpy.ensure_dir(image_dir_path)
      image_path = image_dir_path + "/b.jpg"
      metadata_path = image_dir_path + "/metadata.json"

      if not os.path.exists(image_path) and not os.path.exists(metadata_path):
         self.save_image_to_path(image_path)
         self.save_metadata_to_path(metadata_path)
         print "Stored image/metadata " + image_dir_path
      else:
         print "Already stored " + image_dir_path
コード例 #2
0
name      = sys.argv[1]
timestamp = sys.argv[2]
socialexplorer_csv = sys.argv[3]

border_fraction = 0.0
try:
   border_fraction = float(sys.argv[4])
except:
   pass

facemap = flickrfacemap.FlickrFaceMap(name, timestamp)
face_image = facemap.get_big_image(border_fraction)

left   = float(sys.argv[5])
right  = float(sys.argv[6])
top    = float(sys.argv[7])
bottom = float(sys.argv[8])

racemap = georacedata.GeoRaceData(socialexplorer_csv)
race_image = racemap.get_image(face_image.size[0], (left, right, top, bottom))

race_image.paste(face_image, (0, 0), face_image) # need to use the image as mask too if you want to use its alpha channel, cuz this API is retarded.

facerace_out_dir = "data/facerace"
dpy.ensure_dir(facerace_out_dir)
facerace_path = facerace_out_dir + "/facerace_" + name + "_" + timestamp + ".jpg"
race_image.save(facerace_path)
#face_image.save(facerace_path)
print "Saved face race map to " + facerace_path