I have a Pillow (PIL) image called img
. I create a drawing object with drawer = ImageDraw.Draw(img)
. Now I pass drawer
to a function. How can that function see the size of the image? (If I just pass the image, I can get the size easily with img.size
)
Asked
Active
Viewed 715 times
0

Pro Q
- 4,391
- 4
- 43
- 92
-
Note that an answer to [this question](https://stackoverflow.com/questions/43486077/how-to-get-image-from-imagedraw-in-pil) would suffice as well, but the current answer to that question does not actually answer the question in the title. – Pro Q Jun 21 '18 at 16:12
-
Using the `dir` function, I was able to find that `drawer` has an `im` property, but the `im` property is an ImagingCore object, and I don't know how to turn that into a normal image in order to get the size. – Pro Q Jun 21 '18 at 17:17
1 Answers
0
TL;DR drawer.im.size
The ImageDraw.Draw
object has a property called im
that can be used to get a ImagingCore
object (Note that this is not the usual Image
object) which has a size
property. Testing it, the size property seems to match that of the original image, so that is what I will use for now.

Pro Q
- 4,391
- 4
- 43
- 92