diff --git a/data/history.json b/data/history.json index 929423b..392e8db 100644 --- a/data/history.json +++ b/data/history.json @@ -46,5 +46,29 @@ "image_url": "https://s3.siliconflow.cn/default/outputs/b08427c9-7ea5-4c9e-9fdc-f1e93287771d_d189e8ced99696eda42f83c51b9b8606_ComfyUI_56432b78_00001_.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXXFILESEXAMPLE%2F20260108%2Fcn-shanghai-1%2Fs3%2Faws4_request&X-Amz-Date=20260108T141832Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsImtpZCI6ImdyYXkiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWFzOmRlcDpvcHI6ZDI5Y3UzZ2gzdnZjNzNjNWJpNWc6YWVmNGIiLCJpc3MiOiJodHRwczovL2lhbS5zaWxpY29uZmxvdy5jbiIsImlhdCI6MTc2Nzg3NTYwOSwiZXhwIjoxNzY4MDQ4NDA5LCJ0eXAiOiJzZXJ2aWNlIiwiYXBsdCI6InNmOmZhYXM6ZmFicmljIiwidG50IjoiZDI5Y3UzZ2gzdnZjNzNjNWJpNWciLCJpZCI6ImQ1ZnE4NmM1MG1pczczYmIzbm8wIiwiYWNjZXNzIjpbeyJ0eXBlIjoiZmFhcyIsInN1YmplY3RJZCI6ImQyOWN1M2doM3Z2YzczYzViaTVnIiwiYWN0aW9ucyI6WyJmYWFzOmludm9jYXRpb246cHVsbGluZyJdfV19.cO-aXvKYQfYY7TBx1Y_dq9uCot1uFTyM29D7mSul-aiEvCPM1DR32nrWUBYc879VJieR6pyM_OBgBii9AGvUADVowFDB6nmCOp2jJEwxxqZy5l_FlwmKlsxzAsV4rupgFHOi1vH2CQtRgb0gxD23xkbOsfck45R7LCR2esAc8ktkoWjqvZhR7Lytob7XqQCV0VvuQqio7SaYa9sRuB0REBbU_Hfam2uFw9pRCrxyxvDAsMGJpzhp_LgVCkhti6jqdY75qD2h4xnuFLjEcyStVQZLU_Wq8XbYse5MWe2MkD58_I2bNNsTlvxO3rS-dtDYNkenWG9J2ytrDG42cFa3oZ1eX2cn4ReNDvqJyrj3cHwpDsnPciYGITVXZruq9q9QddYfua6hZsE4HyRJV8Aa-uXRSwnFUkhJwrNPQljWhX2RqkU65cJT53l3fy7LfsjWJxC5jG_TwzxMDNS_KsY2LODS_SlLEyoP3DT_kdG_eXLYLDB3Ist2rPLy8xCbsRCIM5dPABOZ-YcBYp6eZjeesHagw_m5oVBIirgs8CGJrEp_95ZA1MS1PnYBQZry9GXZtIi1hIowPufdkRbcU55ha7oktvZzqe-siXexhH4ilbsm6oNv2uCqP8fllflwrQ8emY7X31rcCeHxvWqM7NggnPyeb02KdUktzfZkQqPPMyI&X-Amz-Signature=15a32d706aad40104109a9302b7bd4027d4cea6cf847f32a59c3f250cd9f326b", "novel_text": "虞寻歌尽可能让自己的语气不要带上任何攻击性,因为她是真的好奇而不是为了挑衅,她站直身体,认真的问道:“那你头发变成浅金色后…岂不是很不适应?”", "timestamp": 1767881913.7345977 + }, + { + "prompt": "**Manga Image Prompt:**\n\n**Style:** Monochrome manga style, high quality, detailed line art with dynamic action lines and speed effects. Game UI overlay with health bars and status indicators visible.\n\n**Scene:** A ruined manor estate at night, with broken stone walls, collapsed towers, and overgrown vegetation. Moonlight casts dramatic shadows across the ruins. The scene is set high above the manor ruins, with crumbling architecture visible below.\n\n**Center Character (虞寻歌):** A game character sprite/small figure positioned at the center of the frame. He has a bleeding dagger icon floating above his head as an emoji/status indicator. He's in mid-air combat stance, launching an attack. His expression is fierce and determined.\n\n**Opponent (苏一瞳):** A black-haired game character sprite/small figure with glowing red wings that emit a soft crimson light. Above his head floats the ID tag 【苏一瞳】in clear game font, along with handshake and heart pattern icons as status indicators. He's positioned opposite 虞寻歌, defending or counter-attacking.\n\n**Action:** Intense aerial combat between the two characters. Energy trails and impact effects surround them. 虞寻歌 is attacking with a weapon or energy blast, while 苏一瞳 uses his glowing red wings to maneuver and defend.\n\n**Composition:** Dynamic diagonal composition with 虞寻歌 at the center, 苏一瞳 positioned at an angle to create tension. Speed lines and motion blur emphasize the high-speed aerial combat. The ruined manor serves as the dramatic backdrop below.\n\n**Lighting:** Dramatic moonlight from above creates strong highlights and deep shadows. The glowing red wings of 苏一瞳 provide a contrasting light source, casting red hues on nearby surfaces.\n\n**Details:** Game UI elements like health bars, skill cooldowns, and damage numbers float near the characters. Debris and dust particles float in the air from the ruined manor below.", + "image_url": "https://s3.siliconflow.cn/default/outputs/a9f400e0-a3cb-452d-a834-8c7b0ea3d36d_b6cbbedf74b234493c377734127172d3_ComfyUI_d9f38225_00001_.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXXFILESEXAMPLE%2F20260108%2Fcn-shanghai-1%2Fs3%2Faws4_request&X-Amz-Date=20260108T154440Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsImtpZCI6ImdyYXkiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWFzOmRlcDpvcHI6ZDI5Y3UzZ2gzdnZjNzNjNWJpNWc6YWVmNGIiLCJpc3MiOiJodHRwczovL2lhbS5zaWxpY29uZmxvdy5jbiIsImlhdCI6MTc2Nzg3NTYwOSwiZXhwIjoxNzY4MDQ4NDA5LCJ0eXAiOiJzZXJ2aWNlIiwiYXBsdCI6InNmOmZhYXM6ZmFicmljIiwidG50IjoiZDI5Y3UzZ2gzdnZjNzNjNWJpNWciLCJpZCI6ImQ1ZnE4NmM1MG1pczczYmIzbm8wIiwiYWNjZXNzIjpbeyJ0eXBlIjoiZmFhcyIsInN1YmplY3RJZCI6ImQyOWN1M2doM3Z2YzczYzViaTVnIiwiYWN0aW9ucyI6WyJmYWFzOmludm9jYXRpb246cHVsbGluZyJdfV19.cO-aXvKYQfYY7TBx1Y_dq9uCot1uFTyM29D7mSul-aiEvCPM1DR32nrWUBYc879VJieR6pyM_OBgBii9AGvUADVowFDB6nmCOp2jJEwxxqZy5l_FlwmKlsxzAsV4rupgFHOi1vH2CQtRgb0gxD23xkbOsfck45R7LCR2esAc8ktkoWjqvZhR7Lytob7XqQCV0VvuQqio7SaYa9sRuB0REBbU_Hfam2uFw9pRCrxyxvDAsMGJpzhp_LgVCkhti6jqdY75qD2h4xnuFLjEcyStVQZLU_Wq8XbYse5MWe2MkD58_I2bNNsTlvxO3rS-dtDYNkenWG9J2ytrDG42cFa3oZ1eX2cn4ReNDvqJyrj3cHwpDsnPciYGITVXZruq9q9QddYfua6hZsE4HyRJV8Aa-uXRSwnFUkhJwrNPQljWhX2RqkU65cJT53l3fy7LfsjWJxC5jG_TwzxMDNS_KsY2LODS_SlLEyoP3DT_kdG_eXLYLDB3Ist2rPLy8xCbsRCIM5dPABOZ-YcBYp6eZjeesHagw_m5oVBIirgs8CGJrEp_95ZA1MS1PnYBQZry9GXZtIi1hIowPufdkRbcU55ha7oktvZzqe-siXexhH4ilbsm6oNv2uCqP8fllflwrQ8emY7X31rcCeHxvWqM7NggnPyeb02KdUktzfZkQqPPMyI&X-Amz-Signature=e34ccc674a053e8663fb1e48643394e867f8d10033a50e82c3fcf41ff4097150", + "novel_text": "游戏画面里,占据画面中心位的小人正在一座庄园废墟的上空和一个长着发光红翅膀的黑发小人对打,对方脑袋上顶着【苏一瞳】的ID。", + "timestamp": 1767887080.9694343 + }, + { + "prompt": "Manga style, monochrome, high quality. Central focus on a game character sprite in mid-air combat. The main character is Yu Xunge (虞寻歌) - a game sprite character with a bleeding dagger emoji symbol floating above their head. They are fighting against Su Yitong (苏一瞳) - a black-haired game sprite character with glowing red wings, ID 【苏一瞳】 displayed above their head along with handshake and heart emoji symbols. Setting: Above the ruins of a grand manor estate - crumbling stone walls, broken columns, overgrown gardens, shattered windows. The two characters are engaged in aerial combat, with dynamic action lines and motion effects. Yu Xunge is attacking with a weapon, while Su Yitong defends with their glowing red wings. Game UI elements visible: health bars, skill cooldown indicators, floating damage numbers. Dramatic lighting with contrast between the dark ruins below and the glowing red wings illuminating the scene. Action-packed composition with diagonal lines creating tension. Detailed line art, manga shading with screentones.", + "image_url": "https://s3.siliconflow.cn/default/outputs/bbfc7152-24f8-44f8-9dfd-24cd1519692a_6bd785cd2e6b26e48c08c6661dd1c08c_ComfyUI_09abdfaa_00001_.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXXFILESEXAMPLE%2F20260108%2Fcn-shanghai-1%2Fs3%2Faws4_request&X-Amz-Date=20260108T155209Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsImtpZCI6ImdyYXkiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWFzOmRlcDpvcHI6ZDI5Y3UzZ2gzdnZjNzNjNWJpNWc6MWUyMjciLCJpc3MiOiJodHRwczovL2lhbS5zaWxpY29uZmxvdy5jbiIsImlhdCI6MTc2Nzg4NjQwOSwiZXhwIjoxNzY4MDU5MjA5LCJ0eXAiOiJzZXJ2aWNlIiwiYXBsdCI6InNmOmZhYXM6ZmFicmljIiwidG50IjoiZDI5Y3UzZ2gzdnZjNzNjNWJpNWciLCJpZCI6ImQ1ZnNzaTk3MTluczczZGZhc2swIiwiYWNjZXNzIjpbeyJ0eXBlIjoiZmFhcyIsInN1YmplY3RJZCI6ImQyOWN1M2doM3Z2YzczYzViaTVnIiwiYWN0aW9ucyI6WyJmYWFzOmludm9jYXRpb246cHVsbGluZyJdfV19.XtxUUMcq-HHTszm_BEdRgYrQuMiMM1KnXjaQPpkHQYwCSXk_LWLgrLZgGJQQUzYuP68Ez6iWzEytSHebwsMWR73NFp0ZcXPYBfkBnSLAIte5oJKl6nF7NZ9On9ghjSaWceueSu9Apm5TaSBtXfWjDMOIbQ0F6_8TliZAa4LZ4Y9xJ88hITOZnL7nKa07NCX40hYdIu4C5NXBr7zfdvICStF3msFNBuRJxadJ2RfoVuPt2AEp3xEpRf3rpsPy9GK60F6qNZPrfnZv5kC4s2hC98Iz8UN9A0BmyaYTMTAqIpcFIE7eaWx9cekSgp0AuWfRG45nG7UnrKMP7TrYN8mL0Yuwn5FPrdGhdNDjbv58PEfLXEkku8Pq2KxGctwXGlwhVsAELad0bVdEMgb_5xv9fb8b4zX4vzwt0fy-Ugv8qV1LINvveW2OlRGZ1Y7DdL6AcJ5H-iGqWFYgYJzkjox4vr_8jtTuHCDXTaPYRd30_PXsCED_gy233UcSKDsMspsCOPmGzO4fNiRpL8kdQjpOl-JhH2djdopv1MyugzARjqSH2f0QgMglKdkQEGd2Ik4gAFuyOKDApNAfmIgltDAsIoKZwhaGohJHiXIw6U14j-dCxEAOe8PArgHVA1EWafjlNvoNCh84_xwvhfAecyI6h7YvZpACom5L_gGMY1yTMTA&X-Amz-Signature=853da71cd62f7652cf4369e31487cb6719e6094b046e3f4f565ec96002d75d8f", + "novel_text": "游戏画面里,占据画面中心位的小人正在一座庄园废墟的上空和一个长着发光红翅膀的黑发小人对打,对方脑袋上顶着【苏一瞳】的ID。", + "timestamp": 1767887529.50243 + }, + { + "prompt": "Manga style, monochrome, high quality. A dynamic gaming scene showing two game character avatars in combat. On the left: Yu Xunge's game character avatar - a small chibi-style character with a determined expression, above his head floats a bleeding dagger emoji symbol that appears to be pulsing or \"popping\" out with motion lines. On the right: Su Yitong's game character avatar - a small chibi-style character with black hair, glowing red wings that emit a soft crimson light, above her head floats both a handshake emoji and a heart emoji that appear to be \"popping\" out with motion lines. The ID tag 【苏一瞳】floats near her character. The two characters are positioned in a virtual gaming arena with digital grid patterns on the ground and faint holographic interface elements in the background. The scene captures the contrast between Yu Xunge's aggressive combat stance and Su Yitong's friendly approach, with emoji symbols creating visual tension. Action lines and speed effects emphasize the dynamic nature of the online battle. Detailed line art, manga shading techniques, and dramatic lighting to highlight the glowing red wings and emoji symbols.", + "image_url": "https://s3.siliconflow.cn/default/outputs/a10a2c86-0645-4904-bbe6-0c35faacad2e_c7bad42deab9a433b5e8e3fb33d24599_ComfyUI_b51df183_00001_.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXXFILESEXAMPLE%2F20260108%2Fcn-shanghai-1%2Fs3%2Faws4_request&X-Amz-Date=20260108T155215Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsImtpZCI6ImdyYXkiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWFzOmRlcDpvcHI6ZDI5Y3UzZ2gzdnZjNzNjNWJpNWc6YWVmNGIiLCJpc3MiOiJodHRwczovL2lhbS5zaWxpY29uZmxvdy5jbiIsImlhdCI6MTc2Nzg3NTYwOSwiZXhwIjoxNzY4MDQ4NDA5LCJ0eXAiOiJzZXJ2aWNlIiwiYXBsdCI6InNmOmZhYXM6ZmFicmljIiwidG50IjoiZDI5Y3UzZ2gzdnZjNzNjNWJpNWciLCJpZCI6ImQ1ZnE4NmM1MG1pczczYmIzbm8wIiwiYWNjZXNzIjpbeyJ0eXBlIjoiZmFhcyIsInN1YmplY3RJZCI6ImQyOWN1M2doM3Z2YzczYzViaTVnIiwiYWN0aW9ucyI6WyJmYWFzOmludm9jYXRpb246cHVsbGluZyJdfV19.cO-aXvKYQfYY7TBx1Y_dq9uCot1uFTyM29D7mSul-aiEvCPM1DR32nrWUBYc879VJieR6pyM_OBgBii9AGvUADVowFDB6nmCOp2jJEwxxqZy5l_FlwmKlsxzAsV4rupgFHOi1vH2CQtRgb0gxD23xkbOsfck45R7LCR2esAc8ktkoWjqvZhR7Lytob7XqQCV0VvuQqio7SaYa9sRuB0REBbU_Hfam2uFw9pRCrxyxvDAsMGJpzhp_LgVCkhti6jqdY75qD2h4xnuFLjEcyStVQZLU_Wq8XbYse5MWe2MkD58_I2bNNsTlvxO3rS-dtDYNkenWG9J2ytrDG42cFa3oZ1eX2cn4ReNDvqJyrj3cHwpDsnPciYGITVXZruq9q9QddYfua6hZsE4HyRJV8Aa-uXRSwnFUkhJwrNPQljWhX2RqkU65cJT53l3fy7LfsjWJxC5jG_TwzxMDNS_KsY2LODS_SlLEyoP3DT_kdG_eXLYLDB3Ist2rPLy8xCbsRCIM5dPABOZ-YcBYp6eZjeesHagw_m5oVBIirgs8CGJrEp_95ZA1MS1PnYBQZry9GXZtIi1hIowPufdkRbcU55ha7oktvZzqe-siXexhH4ilbsm6oNv2uCqP8fllflwrQ8emY7X31rcCeHxvWqM7NggnPyeb02KdUktzfZkQqPPMyI&X-Amz-Signature=ba0f1c87b98be497ba33fbd387c897c697f72c218293fcb4f8b11cbfb3e2e6dd", + "novel_text": "【虞寻歌】小人头顶不停蹦出滴血匕首的表情,【苏一瞳】那边却不停冒出握手和爱心的图案。", + "timestamp": 1767887535.609587 + }, + { + "prompt": "**Manga Image Prompt:**\n\n**Scene:** A close-up shot of 虞寻歌 (Yu Xunge) in the game world, showing a genuine, heartfelt smile on his face. The scene captures a moment of unexpected joy during gameplay.\n\n**Character Details:**\n- **虞寻歌:** Game character sprite with a simple but expressive design. He has a genuine, warm smile that reaches his eyes - a rare expression for him. Above his head floats a dripping blood dagger emoji symbol (🔪💧), indicating his in-game status/role. His character design should be consistent with previous appearances.\n\n**Setting:** Digital game environment with subtle pixelated or digital effects in the background. Soft glow of game interface elements around the edges. The focus is entirely on 虞寻歌's emotional expression.\n\n**Action/Expression:** 虞寻歌 is looking at something off-screen (presumably the game interaction with 苏一瞳), with a genuine, unguarded smile that shows he's truly enjoying the moment. His expression should contrast with the violent dagger emoji above him.\n\n**Style:** Monochrome manga style with high-quality linework. Use dramatic lighting to highlight the smile and emotional moment. Strong contrast between the dark game environment and the character's bright expression. Include subtle motion lines or emotional aura to emphasize the spontaneous nature of the smile.\n\n**Composition:** Close-up shot focusing on 虞寻歌's face and upper body. The dagger emoji should be clearly visible but not distracting from the main emotional focus. Use manga-style panel composition with potential for a single impactful frame.\n\n**Mood:** Unexpected warmth, genuine emotion breaking through the game's competitive atmosphere, a moment of human connection in a digital space.", + "image_url": "https://s3.siliconflow.cn/default/outputs/b897a760-87ff-4eaa-9fb0-6903a94c66cf_daa10782e437cf404bdaee49f7fadd28_ComfyUI_d734c35e_00001_.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXXFILESEXAMPLE%2F20260108%2Fcn-shanghai-1%2Fs3%2Faws4_request&X-Amz-Date=20260108T155221Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=eyJhbGciOiJSUzI1NiIsImtpZCI6ImdyYXkiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiJmYWFzOmRlcDpvcHI6ZDI5Y3UzZ2gzdnZjNzNjNWJpNWc6MWUyMjciLCJpc3MiOiJodHRwczovL2lhbS5zaWxpY29uZmxvdy5jbiIsImlhdCI6MTc2Nzg4NjQwOSwiZXhwIjoxNzY4MDU5MjA5LCJ0eXAiOiJzZXJ2aWNlIiwiYXBsdCI6InNmOmZhYXM6ZmFicmljIiwidG50IjoiZDI5Y3UzZ2gzdnZjNzNjNWJpNWciLCJpZCI6ImQ1ZnNzaTk3MTluczczZGZhc2swIiwiYWNjZXNzIjpbeyJ0eXBlIjoiZmFhcyIsInN1YmplY3RJZCI6ImQyOWN1M2doM3Z2YzczYzViaTVnIiwiYWN0aW9ucyI6WyJmYWFzOmludm9jYXRpb246cHVsbGluZyJdfV19.XtxUUMcq-HHTszm_BEdRgYrQuMiMM1KnXjaQPpkHQYwCSXk_LWLgrLZgGJQQUzYuP68Ez6iWzEytSHebwsMWR73NFp0ZcXPYBfkBnSLAIte5oJKl6nF7NZ9On9ghjSaWceueSu9Apm5TaSBtXfWjDMOIbQ0F6_8TliZAa4LZ4Y9xJ88hITOZnL7nKa07NCX40hYdIu4C5NXBr7zfdvICStF3msFNBuRJxadJ2RfoVuPt2AEp3xEpRf3rpsPy9GK60F6qNZPrfnZv5kC4s2hC98Iz8UN9A0BmyaYTMTAqIpcFIE7eaWx9cekSgp0AuWfRG45nG7UnrKMP7TrYN8mL0Yuwn5FPrdGhdNDjbv58PEfLXEkku8Pq2KxGctwXGlwhVsAELad0bVdEMgb_5xv9fb8b4zX4vzwt0fy-Ugv8qV1LINvveW2OlRGZ1Y7DdL6AcJ5H-iGqWFYgYJzkjox4vr_8jtTuHCDXTaPYRd30_PXsCED_gy233UcSKDsMspsCOPmGzO4fNiRpL8kdQjpOl-JhH2djdopv1MyugzARjqSH2f0QgMglKdkQEGd2Ik4gAFuyOKDApNAfmIgltDAsIoKZwhaGohJHiXIw6U14j-dCxEAOe8PArgHVA1EWafjlNvoNCh84_xwvhfAecyI6h7YvZpACom5L_gGMY1yTMTA&X-Amz-Signature=c607e18a92a81762527b8c75e7aff714161f60fa1c5397c77b67ff5c4246cb24", + "novel_text": "看着看着,虞寻歌竟不自觉发自真心的笑了起来。", + "timestamp": 1767887542.1732938 } ] \ No newline at end of file diff --git a/frontend/main.py b/frontend/main.py index c1e9c38..d0b0450 100644 --- a/frontend/main.py +++ b/frontend/main.py @@ -4,6 +4,8 @@ import os import datetime import base64 from pathlib import Path +from PIL import Image +from io import BytesIO # Configuration ST_BACKEND_URL = os.getenv("BACKEND_URL", "http://localhost:5001") @@ -386,6 +388,62 @@ with tab1: key=f"dl_{i}" ) + st.divider() + st.subheader("3. Stitch & Download Manga") + + # Collect available images + available_images = [] + # Check against the number of prompts we have + if 'prompts' in st.session_state: + for i in range(len(st.session_state['prompts'])): + if f"image_data_{i}" in st.session_state: + available_images.append((i, st.session_state[f"image_data_{i}"])) + + if available_images: + if st.button("🧩 Stitch All Panels Vertically", type="primary"): + try: + with st.spinner("Stitching images..."): + images = [] + for idx, img_bytes in available_images: + img = Image.open(BytesIO(img_bytes)) + images.append(img) + + if images: + # Calculate total dimensions + # Use max width to accommodate all + total_width = max(img.width for img in images) + total_height = sum(img.height for img in images) + + # Create new image + stitched_img = Image.new('RGB', (total_width, total_height), (255, 255, 255)) + + # Paste images + y_offset = 0 + for img in images: + # Center image if widths differ + x_offset = (total_width - img.width) // 2 + stitched_img.paste(img, (x_offset, y_offset)) + y_offset += img.height + + # Save to buffer + buf = BytesIO() + stitched_img.save(buf, format="PNG") + st.session_state['stitched_image'] = buf.getvalue() + st.success("Stitched successfully!") + except Exception as e: + st.error(f"Error stitching images: {e}") + + if 'stitched_image' in st.session_state: + st.image(st.session_state['stitched_image'], caption="Full Manga Strip", use_container_width=True) + st.download_button( + label="⬇️ Download Full Manga", + data=st.session_state['stitched_image'], + file_name="manga_strip.png", + mime="image/png" + ) + else: + st.info("Generate at least one panel image to unlock stitching.") + with tab2: st.header("History") if st.button("🔄 Refresh History"):