Skip to content

Instantly share code, notes, and snippets.

@TimSC
Last active December 18, 2015 04:29
Show Gist options
  • Save TimSC/5725758 to your computer and use it in GitHub Desktop.
Save TimSC/5725758 to your computer and use it in GitHub Desktop.
Get Photos from server
import urllib2, json, StringIO
from PIL import Image
if __name__=="__main__":
urlHandle = urllib2.urlopen("http://192.168.1.9/photodb/getsamples.php")
sampleJson = urlHandle.read()
sampleList = json.loads(sampleJson)
for sample in sampleList:
print sample
url = "http://192.168.1.9/photodb/roiimg.php?roiId="+str(sample['roiId'])
print url
imgDat = StringIO.StringIO(urllib2.urlopen(url).read())
img = Image.open(imgDat)
print img.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment