URL에서 이미지를 가져 와서 해당 문자열을 App Engine 내에서 Image
으로 변환하려고하면 위와 같은 메시지에 오류가 발생합니다.PIL ValueError : 이미지 데이터가 충분하지 않습니까?
from google.appengine.api import urlfetch
def fetch_img(url):
try:
result = urlfetch.fetch(url=url)
if result.status_code == 200:
return result.content
except Exception, e:
logging.error(e)
url = "http://maps.googleapis.com/maps/api/staticmap?center=Narita+International+Airport,Narita,Chiba+Prefecture,+Japan&zoom=18&size=512x512&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false"
img = fetch_img(url)
# As the URL above tells, its size is 512x512
img = Image.fromstring('RGBA', (512, 512), img)
은 PIL에 따르면, 크기 옵션은 픽셀의 튜플 것으로 생각된다. 내가 지정한이. 아무도 내 오해를 지적 할 수 있을까?
질문을, 오히려 우리를 위해 오류를 의역보다는, 전체 스택 트레이스를 기입하십시오. –