Skip to content

Commit

Permalink
added Dr. Pi image
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimKorzh committed Jun 30, 2021
1 parent c344995 commit a86389a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# auto-draw
Drawing automation with PyAutoGUI

# Listen to examples
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/St48jGas_60/0.jpg)](https://www.youtube.com/watch?v=St48jGas_60&list=PLLfIBXQeu3abdRtBW4xHy96--R5OIwK2a)

# Install dependencies
pip install pyautogui

# How to use it
1. Open your favourite graphics editor
2. Adjust cursor starting position in "draw.py" if needed
3. Run the script in console via: "python draw.py"


11 changes: 6 additions & 5 deletions src/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
(thresh, blackAndWhiteImage) = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY)

# uncomment below lines to preview image
#cv2.imshow('Black white image', blackAndWhiteImage)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
cv2.imshow('Black & white image', blackAndWhiteImage)
cv2.waitKey(0)
cv2.destroyAllWindows()

# global coordinates of where to start drawing (change if needed!)
x_start = 100
Expand All @@ -44,8 +44,8 @@
random_rows = list(range(len(blackAndWhiteImage)))

# comment two lines below if you want a "printer" like behavior
#random_rows = random.sample(range(len(blackAndWhiteImage)), len(blackAndWhiteImage))
#random.shuffle(random_rows)
random_rows = random.sample(range(len(blackAndWhiteImage)), len(blackAndWhiteImage))
random.shuffle(random_rows)

# loop over pixel rows
for y in random_rows:
Expand All @@ -59,6 +59,7 @@
if row[x] == 0:
# draw pixel!
pg.click(x_start + x, y_start + y, _pause=False)
print('Drawing at:', x_start + x, y_start + y)

# animation speed
time.sleep(0.008)
Expand Down
Binary file modified src/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a86389a

Please sign in to comment.