Image Properties¶
-
imageSize
(path)¶ Return the width and height of an image.
print(imageSize("https://d1sz9tkli0lfjq.cloudfront.net/items/1T3x1y372J371p0v1F2Z/drawBot.jpg"))
-
imagePixelColor
(path, (x, y))¶ Return the color r, g, b, a of an image at a specified x, y possition.
# path to the image path = u"https://d1sz9tkli0lfjq.cloudfront.net/items/1T3x1y372J371p0v1F2Z/drawBot.jpg" # get the size of the image w, h = imageSize(path) # setup a variable for the font size as for the steps s = 15 # shift it up a bit translate(100, 100) # set a font with a size font("Helvetica-Bold") fontSize(s) # loop over the width of the image for x in range(0, w, s): # loop of the height of the image for y in range(0, h, s): # get the color color = imagePixelColor(path, (x, y)) if color: r, g, b, a = color # set the color fill(r, g, b, a) # draw some text text("W", (x, y))
-
imageResolution
(path)¶ Return the image resolution for a given image.
-
numberOfPages
(path)¶ Return the number of pages for a given pdf or (animated) gif.