-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.
Description
What did you do?
Just tried to run simple code (ImageDraw)
What did you expect to happen?
What actually happened?
Exception looks very basic:
save_handler(self, fp, filename)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/PIL/PngImagePlugin.py", line 1225, in _save
fp.write(_MAGIC)
TypeError: write() argument must be str, not bytes
What are your OS, Python and Pillow versions?
- OS: Android app, "pydroid3" (I don't have a computer now to check it)
- Python: 3.8.3
- Pillow: 8.1.2
import sys
from PIL import Image, ImageDraw
# list of dots, in the following format: [x, y, x, y, x, y,...]
first = (146, 399, 163, 403, 170, 393, 169, 391, 166, 386, 170, 381, 170) #.... long tuple
with Image.open("draw image.jpg") as img:
draw = ImageDraw.Draw(img)
for i in range(len(first)//2 - 1):
draw.line(first[2*i : 2*i + 4])
# write to stdout
img.save(sys.stdout, "PNG")Sorry if I didn't understand the concept... This is my first issue ever...
Metadata
Metadata
Assignees
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.