1 line
7.3 KiB
JSON
1 line
7.3 KiB
JSON
{"sha":"89014d833d2ad0998d724090eff1456692692a1d","node_id":"C_kwDOLGBTQ9oAKDg5MDE0ZDgzM2QyYWQwOTk4ZDcyNDA5MGVmZjE0NTY2OTI2OTJhMWQ","commit":{"author":{"name":"chflame163","email":"chflame@163.com","date":"2025-09-10T16:06:21Z"},"committer":{"name":"chflame163","email":"chflame@163.com","date":"2025-09-10T16:06:21Z"},"message":"commit NanoBanana Image Scale node","tree":{"sha":"338d8bf0ff7f1c01703b52b024fc03ffabaf49cb","url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/git/trees/338d8bf0ff7f1c01703b52b024fc03ffabaf49cb"},"url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/git/commits/89014d833d2ad0998d724090eff1456692692a1d","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}},"url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/commits/89014d833d2ad0998d724090eff1456692692a1d","html_url":"https://github.com/chflame163/ComfyUI_LayerStyle/commit/89014d833d2ad0998d724090eff1456692692a1d","comments_url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/commits/89014d833d2ad0998d724090eff1456692692a1d/comments","author":{"login":"chflame163","id":130118553,"node_id":"U_kgDOB8FzmQ","avatar_url":"https://avatars.githubusercontent.com/u/130118553?v=4","gravatar_id":"","url":"https://api.github.com/users/chflame163","html_url":"https://github.com/chflame163","followers_url":"https://api.github.com/users/chflame163/followers","following_url":"https://api.github.com/users/chflame163/following{/other_user}","gists_url":"https://api.github.com/users/chflame163/gists{/gist_id}","starred_url":"https://api.github.com/users/chflame163/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chflame163/subscriptions","organizations_url":"https://api.github.com/users/chflame163/orgs","repos_url":"https://api.github.com/users/chflame163/repos","events_url":"https://api.github.com/users/chflame163/events{/privacy}","received_events_url":"https://api.github.com/users/chflame163/received_events","type":"User","user_view_type":"public","site_admin":false},"committer":{"login":"chflame163","id":130118553,"node_id":"U_kgDOB8FzmQ","avatar_url":"https://avatars.githubusercontent.com/u/130118553?v=4","gravatar_id":"","url":"https://api.github.com/users/chflame163","html_url":"https://github.com/chflame163","followers_url":"https://api.github.com/users/chflame163/followers","following_url":"https://api.github.com/users/chflame163/following{/other_user}","gists_url":"https://api.github.com/users/chflame163/gists{/gist_id}","starred_url":"https://api.github.com/users/chflame163/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chflame163/subscriptions","organizations_url":"https://api.github.com/users/chflame163/orgs","repos_url":"https://api.github.com/users/chflame163/repos","events_url":"https://api.github.com/users/chflame163/events{/privacy}","received_events_url":"https://api.github.com/users/chflame163/received_events","type":"User","user_view_type":"public","site_admin":false},"parents":[{"sha":"42ccdd8f75ab312285eaa77073a5cc20bdba484c","url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/commits/42ccdd8f75ab312285eaa77073a5cc20bdba484c","html_url":"https://github.com/chflame163/ComfyUI_LayerStyle/commit/42ccdd8f75ab312285eaa77073a5cc20bdba484c"}],"stats":{"total":68,"additions":67,"deletions":1},"files":[{"sha":"f0e55ac363965b178a40c44e23b97b729954a943","filename":"py/nano_banana_image_scale.py","status":"added","additions":66,"deletions":0,"changes":66,"blob_url":"https://github.com/chflame163/ComfyUI_LayerStyle/blob/89014d833d2ad0998d724090eff1456692692a1d/py%2Fnano_banana_image_scale.py","raw_url":"https://github.com/chflame163/ComfyUI_LayerStyle/raw/89014d833d2ad0998d724090eff1456692692a1d/py%2Fnano_banana_image_scale.py","contents_url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/contents/py%2Fnano_banana_image_scale.py?ref=89014d833d2ad0998d724090eff1456692692a1d","patch":"@@ -0,0 +1,66 @@\n+import torch\n+from PIL import Image\n+from .imagefunc import log, tensor2pil, pil2tensor, fit_resize_image\n+\n+\n+PREFERED_BANANA_RESOLUTIONS = [\n+ (1024, 1024),\n+ (1184, 864),\n+ (864, 1184),\n+ (832, 1248),\n+ (1248, 832),\n+ (768, 1344),\n+ (1344, 768),\n+]\n+\n+\n+class LS_NanoBananaImageScale:\n+ @classmethod\n+ def INPUT_TYPES(s):\n+ method_mode = ['lanczos', 'bicubic', 'hamming', 'bilinear', 'box', 'nearest']\n+ return {\"required\": {\"image\": (\"IMAGE\", ),\n+ \"method\": (method_mode,),\n+ },\n+ }\n+\n+ RETURN_TYPES = (\"IMAGE\",)\n+ FUNCTION = \"scale\"\n+\n+ CATEGORY = '😺dzNodes/LayerUtility'\n+ DESCRIPTION = \"This node resizes the image to one that is more optimal for nano-banana. For images with different aspect ratio, the scale will be adjusted appropriately to maintain all information\"\n+\n+ def scale(self, image, method):\n+ ret_images = []\n+\n+ width = image.shape[2]\n+ height = image.shape[1]\n+ aspect_ratio = width / height\n+ _, target_width, target_height = min((abs(aspect_ratio - w / h), w, h) for w, h in PREFERED_BANANA_RESOLUTIONS)\n+\n+ resize_sampler = Image.LANCZOS\n+ if method == \"bicubic\":\n+ resize_sampler = Image.BICUBIC\n+ elif method == \"hamming\":\n+ resize_sampler = Image.HAMMING\n+ elif method == \"bilinear\":\n+ resize_sampler = Image.BILINEAR\n+ elif method == \"box\":\n+ resize_sampler = Image.BOX\n+ elif method == \"nearest\":\n+ resize_sampler = Image.NEAREST\n+\n+ for img in image:\n+ _image = torch.unsqueeze(img, 0)\n+ _image = tensor2pil(img).convert('RGB')\n+ resized_image = fit_resize_image(_image, target_width, target_height, 'fill', resize_sampler)\n+ ret_images.append(pil2tensor(resized_image))\n+\n+ return (torch.cat(ret_images, dim=0),)\n+\n+NODE_CLASS_MAPPINGS = {\n+ \"LayerUtility: NanoBananaImageScale\": LS_NanoBananaImageScale\n+}\n+\n+NODE_DISPLAY_NAME_MAPPINGS = {\n+ \"LayerUtility: NanoBananaImageScale\": \"LayerUtility: Nano Banana Image Scale\"\n+}\n\\ No newline at end of file"},{"sha":"0dbed25a63895acc99935c10087c7ae90d775911","filename":"pyproject.toml","status":"modified","additions":1,"deletions":1,"changes":2,"blob_url":"https://github.com/chflame163/ComfyUI_LayerStyle/blob/89014d833d2ad0998d724090eff1456692692a1d/pyproject.toml","raw_url":"https://github.com/chflame163/ComfyUI_LayerStyle/raw/89014d833d2ad0998d724090eff1456692692a1d/pyproject.toml","contents_url":"https://api.github.com/repos/chflame163/ComfyUI_LayerStyle/contents/pyproject.toml?ref=89014d833d2ad0998d724090eff1456692692a1d","patch":"@@ -1,7 +1,7 @@\n [project]\n name = \"comfyui_layerstyle\"\n description = \"A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress.\"\n-version = \"2.0.23\"\n+version = \"2.0.24\"\n license = {text = \"MIT License\"}\n dependencies = [\"numpy\", \"pillow\", \"torch\", \"matplotlib\", \"Scipy\", \"scikit_image\", \"scikit_learn\", \"opencv-contrib-python\", \"pymatting\", \"timm\", \"colour-science\", \"transformers\", \"blend_modes\", \"huggingface_hub\", \"loguru\"]\n "}]} |