From ecefb7f00a76f69bedaabdfb813b45f2582988ae Mon Sep 17 00:00:00 2001 From: Fill Date: Fri, 3 Oct 2025 21:31:45 -0700 Subject: [PATCH] twaeks --- nodes/FL_VertexGemini25FlashImage.py | 27 ++++++++++++++++++++++++++- pyproject.toml | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/nodes/FL_VertexGemini25FlashImage.py b/nodes/FL_VertexGemini25FlashImage.py index 58acbeb..9092b2d 100644 --- a/nodes/FL_VertexGemini25FlashImage.py +++ b/nodes/FL_VertexGemini25FlashImage.py @@ -1,6 +1,7 @@ import os import io import json +import base64 import torch import numpy as np from PIL import Image @@ -265,7 +266,31 @@ class FL_VertexGemini25FlashImage: if hasattr(part.inline_data, 'mime_type'): self._log(f"Batch {batch_idx + 1} - inline_data mime_type: {part.inline_data.mime_type}") - # Check image header to identify format + # Check if data is base64 encoded (starts with base64 characters) + # Raw binary images start with magic bytes (e.g., PNG: \x89PNG, JPEG: \xff\xd8) + # Base64 encoded data will be ASCII/UTF-8 text + is_base64 = False + try: + # Check if the data looks like base64 (ASCII text) + if isinstance(image_data, bytes): + # Try to decode as ASCII - base64 is ASCII + test_str = image_data[:20].decode('ascii') + # Check if it starts with common base64 PNG prefix + if test_str.startswith('iVBORw0KG') or test_str.startswith('/9j/'): + is_base64 = True + self._log(f"Batch {batch_idx + 1} - Detected base64-encoded data") + except: + pass + + # Decode base64 if needed + if is_base64: + try: + image_data = base64.b64decode(image_data) + self._log(f"Batch {batch_idx + 1} - Decoded base64, new size: {len(image_data)} bytes") + except Exception as e: + self._log(f"Batch {batch_idx + 1} - Failed to decode base64: {str(e)}") + + # Check image header to identify format (after potential base64 decode) image_header = image_data[:16] if len(image_data) >= 16 else image_data self._log(f"Batch {batch_idx + 1} - image header (hex): {image_header.hex()}") diff --git a/pyproject.toml b/pyproject.toml index 8c4ee74..00e6850 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_fill-nodes" description = "Fill-Nodes is a versatile collection of custom nodes for ComfyUI that extends functionality across multiple domains. Features include advanced image processing (pixelation, slicing, masking), visual effects generation (glitch, halftone, pixel art), comprehensive file handling (PDF creation/extraction, Google Drive integration), AI model interfaces (GPT, DALL-E, Hugging Face), utility nodes for workflow enhancement, and specialized tools for video processing, captioning, and batch operations. The pack provides both practical workflow solutions and creative tools within a unified node collection." -version = "1.8.5" +version = "1.8.6" license = "LICENSE" dependencies = ["diffusers", "librosa", "sounddevice", "glitch_this", "PyOpenGL", "glfw", "scipy>=1.13.1", "requests", "aiohttp", "moviepy", "matplotlib", "reportlab", "openai", "PyPDF2", "pdf2image", "PyMuPDF", "reportlab", "PyPDF2", "ollama", "kornia", "opencv-python", "gdown", "open_clip_torch", "google-genai"]