from uwimg import *
import sys

# 1. Getting and setting pixels
flag = False
# flag = True
if flag:
    im = load_image("data/dog.jpg")
    for row in range(im.h):
        for col in range(im.w):
            set_pixel(im, col, row, 0, 0)
    save_image(im, "dog_no_red")

# 3. Grayscale image
flag = False
# flag = True
if flag:
    im = load_image("data/colorbar.png")
    graybar = rgb_to_grayscale(im)
    save_image(graybar, "graybar")

# 4. Shift Image
flag = False
# flag = True
if flag:
    im = load_image("data/dog.jpg")
    shift_image(im, 0, .4)
    shift_image(im, 1, .4)
    shift_image(im, 2, .4)
    save_image(im, "overflow")

# 5. Clamp Image
flag = False
# flag = True
if flag:
    clamp_image(im)
    save_image(im, "doglight_fixed")

# 6-7. Colorspace and saturation
# flag = False
flag = True
if flag:
    im = load_image("data/dog.jpg")
    rgb_to_hsv(im)
    # shift_image(im, 1, .2)
    scale_image(im, 1, 2)
    clamp_image(im)
    hsv_to_rgb(im)
    save_image(im, "dog_saturated2")
