This article describes the method of python reading pictures from the network and processing them directly. Share it for your reference. The specific implementation method is as follows:
The following code can realize the reading of an image from the network without saving it as a local file, and the image is processed directly through the Image module. The cStringIO library is used here, which mainly simulates the image data read from the network to the local file.
import urllib2 import Image import cStringIO def ImageScale(url,size): file = ((url).read()) img = (file) ()
I hope this article will be helpful to everyone's Python programming.