#!/usr/bin/env python3

from PIL import Image
import sys, random

def rgb2hex(r, g, b, *a):
    if len(a) > 0 and a[0] == 0:
        return ''
    return '{:02x}{:02x}{:02x}'.format(r,g,b)

i = Image.open(sys.argv[1],'r')
w, h = i.size
p = list(i.getdata())

xx = list(range(w))
yy = list(range(h))

while True:
    for y in yy:
        for x in range(w):
            print(f"PX {x+int(sys.argv[2])} {y+int(sys.argv[3])} {rgb2hex(*p[y*w+x])}")
