import sys
import pygame
import random
#command line
image = sys.argv[1]
#loading the image and importing
inputImage = pygame.image.load(image)
#getting the image's height and width
(width,height) = inputImage.get_size()
#creating the bigger windom of the image by multiplying original size by 6
window = pygame.display.set_mode((width*6,height*6))
for x in range(height):
for y in range(width):
#rgb coordinates in the x and y image
(r,g,b,_) = inputImage.get_at((x,y))
#Calculate required number of circles
n1 = int(r/5)
n2 = int(g/5)
n3 = int(b/5)
#drawing random red circles on the image
while(n1 > 0):
pygame.draw.circle(window,(255,0,0),(random.randint((x*5)-15,(x*5)),random.randint((y*5)-15,(y*5))),1)
n1 = n1-1
#drawing random green circles on the image
while(n2 > 0):
pygame.draw.circle(window,(0,255,0),(random.randint((x*5)-15,(x*5)),random.randint((y*5)-15,(y*5))),1)
n2= n2-1
#drawing random blue circles on the image
while(n3 > 0):
pygame.draw.circle(window,(0,0,255),(random.randint((x*5)-15,(x*5)),random.randint((y*5)-15,(y*5))),1)
n3 = n3-1
#updating the image
pygame.display.update()
pygame.time.delay(5000)
My code sends me an error saying what the title is, so when I try to change the sys.argv line into image = sys.argv[0] It gives me a different error saying: pygame.error: Unsupported image format and I am not sure what that means? Am I missing something important? Also, if you guys can help me as to how to show the pygame window after fixing the code will much appreciated :)