import pathlib

current = pathlib.Path(__file__).parent
root = current.parent

import sys
sys.path.append(str(root))

import assets

import base64

print("Opening \"sample.png\" sample image.")

with open("sample.png", "rb") as sample:
    result = base64.b64encode(sample.read())

print("Opened, size: " + str(len(result)))
print()

full = pathlib.Path("sample.full.png")
thumbnail = pathlib.Path("sample.thumbnail.webp")

print("Create image object:")
sample = assets.image(result)
sample.save_full(full)
sample.save_thumbnail(thumbnail)

print("File saved. All went well.")
print()

input("Press enter to remove:")
print("Removing files...")

full.unlink()
thumbnail.unlink()


