#๐ help with script
82 messages ยท Page 1 of 1 (latest)
@hidden tide
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
this is the script
import requests
from PIL import Image
import numpy as np
import cv2
import keyboard
def download_image(url):
response = requests.get(url)
if response.status_code == 200:
with open("image.jpg", 'wb') as file:
file.write(response.content)
else:
print("Failed to download image.")
exit()
def process_image(image_path):
image = Image.open(image_path)
gray_image = image.convert("L") # Convert to grayscale
gray_image.save("gray_image.jpg")
return gray_image
def autodraw(image):
image_array = np.array(image)
height, width = image_array.shape
canvas = np.ones((height, width, 3), dtype=np.uint8) * 255 # White canvas
for y in range(height):
for x in range(width):
color = image_array[y, x]
cv2.circle(canvas, (x, y), 1, (color, color, color), -1)
cv2.imshow("Autodraw", canvas)
cv2.waitKey(0)
cv2.destroyAllWindows()
def main():
url = "https://www.example.com/kitten.jpg" # Replace with your chosen image URL
download_image(url)
gray_image = process_image("image.jpg")
print("Press 'F' to start autodrawing...")
keyboard.wait('f')
autodraw(gray_image)
if name == "main":
main()
Hey @hidden tide!
It looks like you're trying to paste code into this channel.
Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.
To do this, use the following method:
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
You can **edit your original message** to correct your code block.
!code
Failed to download image.
are you using venv?
idk that i don't think so no
did you pip install opencv-python
nop
oki
do i do it?
well thats a good place to start
retry to run the script?
same error
is it the same error?
yes
did pip install work correctly
Requirement already satisfied: opencv-python in c:\users\fatob\appdata\local\programs\python\python312\lib\site-packages (4.10.0.84)
Requirement already satisfied: numpy>=1.21.2 in c:\users\fatob\appdata\local\programs\python\python312\lib\site-packages (from opencv-python) (1.26.3)
(am new)
okay so you have opencv
but that came up when i pasted pip install opencv-python
ohh oke mb am new to phyton
so what do u think i should do?
uh i dont get how could u give example?
might be too big a project for a beginner
opencv is not simple
no please i really need this to work.
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
or use that
import requests
from PIL import Image
import numpy as np
import cv2
import keyboard
def download_image(url):
response = requests.get(url)
if response.status_code == 200:
with open("image.jpg", 'wb') as file:
file.write(response.content)
else:
print("Failed to download image.")
exit()
def process_image(image_path):
image = Image.open(image_path)
gray_image = image.convert("L") # Convert to grayscale
gray_image.save("gray_image.jpg")
return gray_image
def autodraw(image):
image_array = np.array(image)
height, width = image_array.shape
canvas = np.ones((height, width, 3), dtype=np.uint8) * 255 # White canvas
for y in range(height):
for x in range(width):
color = image_array[y, x]
cv2.circle(canvas, (x, y), 1, (color, color, color), -1)
cv2.imshow("Autodraw", canvas)
cv2.waitKey(0)
cv2.destroyAllWindows()
def main():
url = "https://www.example.com/kitten.jpg" # Replace with your chosen image URL
download_image(url)
gray_image = process_image("image.jpg")
print("Press 'F' to start autodrawing...")
keyboard.wait('f')
autodraw(gray_image)
if __name__ == "__main__":
main()
this is gpt right
yess
Did you forget to pip install something?
you dont have an actual url made.
naw they have the pip
what do you expect autodraw to do?
K.
just autodraw? or wym
ohhh
yes what do you actually want to autodrwa to do
spiderman this is just an test i want to see if it really works
then it can be drawing some other stuffs
what do you want the result to do?
i ask bc i don't think this code will do what you want it to do
ohhhhh
you give it an image and what does it create?
what do you expect it to create
idk
you have no idea what you want the code to do?
what do you want to do with that url?
what is the output of your code supposed to be?
draw what is shown here
i have no idea what that means. a coloring app to draw a picture of a picture?
the script is suppose to do something like this
the game for the lazy ones: https://web.roblox.com/games/1547610457/Free-Draw-2
note: this does not work on mobile, and mac os, this program is for Windows only. And it does not work on executors, and black and white only.
download autoit v3: https://www.autoitscript.com/site/autoit/downloads/
drawing script: https://www.autoitscript.com/foru...
guys nvm i do not have any expirence with coding or something like that i don't think i will come far with only chat gpt๐๐
thanks for helping guys tho
u can delete this post now
!close
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.