"""Original CC0 synthetic PNG studies; Python + Pillow 11.3.0; no outside photographs."""
from pathlib import Path
from PIL import Image,ImageDraw,PngImagePlugin
import math,random
p=Path('generated-png-fixtures');p.mkdir(exist_ok=True)
im=Image.new('RGBA',(128,64));d=ImageDraw.Draw(im)
for i,a in enumerate([0,64,128,255]):d.rectangle((i*32,0,i*32+31,63),fill=(32,152,112,a))
im.save(p/'alpha-bands.png')
im=Image.new('RGB',(32,32),'white');d=ImageDraw.Draw(im)
for y in range(32):
    for x in range(32):
        if (x//4+y//4)%2:d.point((x,y),fill=(224,36,64))
im.save(p/'flat-checks.png')
im=Image.new('RGB',(400,160),'white');d=ImageDraw.Draw(im)
for x in range(0,400,2):d.line((x,0,x,63),fill=(255,0,0))
for x in range(1,400,2):d.line((x,0,x,63),fill=(0,0,255))
d.rectangle((12,82,388,148),fill=(236,247,241));d.text((24,104),'Thin colored lines and small text: Filepetal 0123456789',fill=(18,96,54))
im.save(p/'colored-detail.png')
im=Image.new('RGB',(320,192));rng=random.Random(20261014)
for y in range(192):
    for x in range(320):
        n=rng.randrange(-12,13)
        im.putpixel((x,y),(max(0,min(255,40+x*190//319+n)),max(0,min(255,35+y*170//191+n)),max(0,min(255,int(105+55*math.sin(x/23)+35*math.cos(y/17)+n)))))
im.save(p/'photo-like.png')
im=Image.new('RGB',(96,48),(32,152,112));meta=PngImagePlugin.PngInfo();meta.add_text('Title','Original metadata boundary');meta.add_text('Comment','Synthetic sample; not personal information')
im.save(p/'metadata-note.png',pnginfo=meta,dpi=(300,300))
frames=[Image.new('RGBA',(48,32),c) for c in [(220,30,30,255),(30,60,220,255)]]
for f in frames:ImageDraw.Draw(f).rectangle((0,0,7,7),fill='white')
frames[0].save(p/'animated-marker.png',save_all=True,append_images=frames[1:],duration=[100,300],loop=0,disposal=0,blend=0)
(p/'wrong-header.png').write_bytes(b'Filepetal synthetic wrong PNG header\n')
(p/'truncated.png').write_bytes((p/'alpha-bands.png').read_bytes()[:40])
Image.new('RGBA',(4097,32),(32,152,112,255)).save(p/'oversized.png')
print('Generated nine original PNG inputs, including two-frame APNG and three error boundaries.')
