The sheet composer drew light lines between the three poses and between the top and bottom rows, cutting through capes and swords. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""The character concept sheet is composed without divider lines between panels."""
|
|
from __future__ import annotations
|
|
|
|
import base64
|
|
import io
|
|
import os
|
|
import tempfile
|
|
import unittest
|
|
|
|
os.environ.setdefault("CONFIG_DIR", tempfile.mkdtemp(prefix="ttvc-refsheet-test-config-"))
|
|
|
|
from PIL import Image
|
|
|
|
import routes.conversation as conversation
|
|
|
|
BG = (246, 242, 234)
|
|
|
|
|
|
def _png(color):
|
|
out = io.BytesIO()
|
|
Image.new("RGB", (1536, 1024), color).save(out, format="PNG")
|
|
return out.getvalue()
|
|
|
|
|
|
class ComposeReferenceNoDividers(unittest.TestCase):
|
|
def test_no_lines_between_panels(self):
|
|
# Every panel is the same colour as the sheet background, so any pixel that differs is a drawn line.
|
|
images = {k: _png(BG) for k in ("turnaround", "scene", "prop1", "prop2")}
|
|
for props in (0, 1, 2):
|
|
uri = conversation._compose_character_reference(images, props)
|
|
img = Image.open(io.BytesIO(base64.b64decode(uri.split(",", 1)[1]))).convert("RGB")
|
|
self.assertEqual(img.size, (1536, 1536))
|
|
self.assertEqual(img.getcolors(maxcolors=16), [(1536 * 1536, BG)], f"divider drawn with {props} props")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|