Python Operation network Picture

Source: Internet
Author: User
#!/usr/bin/env python#encoding=utf-8 Import Cstringio, urllib2, Image url = 'http://www.bz55.com/uploads/allimg/ 150309/139-150309101a0.jpg' file = Urllib2.urlopen (URL) tmpim = Cstringio.stringio (File.read ()) im = Image.open ( TMPIM) Print Im.format, im.size, Im.mode

The biggest advantage of this method, the picture read into memory, do not need to save the picture to the local, save the local disk space, run out of memory. But not suitable for large-volume operation of pictures.

Also, do not understand, how to manipulate the local image like the image is BASE64 encoded. Have to know the students welcome comments pointed out, greatly appreciated!

Python Operation network Picture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.