1

How I can speed up the speed at which my program writes an online image to disk? Right now ~150KB takes ~8 seconds to download, 3 seconds for opening the image online and 5 seconds to write it. Currently I'm doing it like this:

import mechanize

br = mechanize.Browser()
br.set_handle_robots(False)
request = get_request('link.to.image')
online_image = br.open(request)
with open(image_name, 'wb') as f:
    f.write(online_image.read())

What can I do to speed this up? And is there a way to write to disk as the image is being opened?

オパラ
  • 317
  • 2
  • 10

0 Answers0