Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get image RGB data from URL

from PIL import Image
from io import BytesIO

# BBC Test Card F image from 1967
url = 'https://upload.wikimedia.org/wikipedia/en/5/52/Testcard_F.jpg'
import requests

response = requests.get(url)
img = Image.open(BytesIO(response.content))

import numpy as np
npimg = np.array(img) # 3 dim array first to dims are pixel x,y
                      # last dim is color
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #image #RGB #data #URL
ADD COMMENT
Topic
Name
9+2 =