Skip to content

Commit

Permalink
fix Bria Expand
Browse files Browse the repository at this point in the history
  • Loading branch information
georgi committed Jan 12, 2025
1 parent ad3cb6d commit 36df55f
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 65 deletions.
141 changes: 89 additions & 52 deletions src/nodetool/metadata/nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -22381,9 +22381,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 683193,
"minute": 44,
"second": 21,
"microsecond": 594860,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23423,9 +23423,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 687191,
"minute": 44,
"second": 21,
"microsecond": 598829,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23476,9 +23476,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 687431,
"minute": 44,
"second": 21,
"microsecond": 599201,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23529,9 +23529,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 687655,
"minute": 44,
"second": 21,
"microsecond": 599500,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23582,9 +23582,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 687866,
"minute": 44,
"second": 21,
"microsecond": 599751,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23635,9 +23635,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 688080,
"minute": 44,
"second": 21,
"microsecond": 599977,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23688,9 +23688,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 688334,
"minute": 44,
"second": 21,
"microsecond": 600238,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23741,9 +23741,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 688547,
"minute": 44,
"second": 21,
"microsecond": 600454,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -23810,9 +23810,9 @@
"month": 1,
"day": 12,
"hour": 17,
"minute": 36,
"second": 56,
"microsecond": 688802,
"minute": 44,
"second": 21,
"microsecond": 600708,
"tzinfo": "UTC",
"utc_offset": 0.0
},
Expand Down Expand Up @@ -83102,56 +83102,92 @@
"max": null
},
{
"name": "canvas_size",
"name": "canvas_width",
"type": {
"type": "list",
"type": "int",
"optional": false,
"values": null,
"type_args": [],
"type_name": null
},
"default": [
1200,
674
],
"title": "Canvas Size",
"description": "The desired size of the final image, after the expansion",
"default": 1200,
"title": "Canvas Width",
"description": "The desired width of the final image, after the expansion",
"min": null,
"max": null
},
{
"name": "original_image_size",
"name": "canvas_height",
"type": {
"type": "list",
"type": "int",
"optional": false,
"values": null,
"type_args": [],
"type_name": null
},
"default": [
610,
855
],
"title": "Original Image Size",
"description": "The desired size of the original image, inside the full canvas",
"default": 674,
"title": "Canvas Height",
"description": "The desired height of the final image, after the expansion",
"min": null,
"max": null
},
{
"name": "original_image_location",
"name": "original_image_width",
"type": {
"type": "list",
"type": "int",
"optional": false,
"values": null,
"type_args": [],
"type_name": null
},
"default": [
301,
-66
],
"title": "Original Image Location",
"description": "The desired location of the original image, inside the full canvas",
"default": 610,
"title": "Original Image Width",
"description": "The desired width of the original image, inside the full canvas",
"min": null,
"max": null
},
{
"name": "original_image_height",
"type": {
"type": "int",
"optional": false,
"values": null,
"type_args": [],
"type_name": null
},
"default": 855,
"title": "Original Image Height",
"description": "The desired height of the original image, inside the full canvas",
"min": null,
"max": null
},
{
"name": "original_image_x",
"type": {
"type": "int",
"optional": false,
"values": null,
"type_args": [],
"type_name": null
},
"default": 301,
"title": "Original Image X",
"description": "The desired x-coordinate of the original image, inside the full canvas",
"min": null,
"max": null
},
{
"name": "original_image_y",
"type": {
"type": "int",
"optional": false,
"values": null,
"type_args": [],
"type_name": null
},
"default": -66,
"title": "Original Image Y",
"description": "The desired y-coordinate of the original image, inside the full canvas",
"min": null,
"max": null
},
Expand Down Expand Up @@ -83233,7 +83269,8 @@
"recommended_models": [],
"basic_fields": [
"image",
"canvas_size",
"canvas_width",
"canvas_height",
"prompt"
]
},
Expand Down
38 changes: 25 additions & 13 deletions src/nodetool/nodes/fal/image_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,17 +916,29 @@ class BriaExpand(FALNode):
default=ImageRef(),
description="The input image to expand"
)
canvas_size: list = Field(
default=[1200, 674],
description="The desired size of the final image, after the expansion"
canvas_width: int = Field(
default=1200,
description="The desired width of the final image, after the expansion"
)
original_image_size: list = Field(
default=[610, 855],
description="The desired size of the original image, inside the full canvas"
canvas_height: int = Field(
default=674,
description="The desired height of the final image, after the expansion"
)
original_image_location: list = Field(
default=[301, -66],
description="The desired location of the original image, inside the full canvas"
original_image_width: int = Field(
default=610,
description="The desired width of the original image, inside the full canvas"
)
original_image_height: int = Field(
default=855,
description="The desired height of the original image, inside the full canvas"
)
original_image_x: int = Field(
default=301,
description="The desired x-coordinate of the original image, inside the full canvas"
)
original_image_y: int = Field(
default=-66,
description="The desired y-coordinate of the original image, inside the full canvas"
)
prompt: str = Field(
default="",
Expand All @@ -950,9 +962,9 @@ async def process(self, context: ProcessingContext) -> ImageRef:

arguments = {
"image_url": f"data:image/png;base64,{image_base64}",
"canvas_size": self.canvas_size,
"original_image_size": self.original_image_size,
"original_image_location": self.original_image_location,
"canvas_size": [self.canvas_width, self.canvas_height],
"original_image_size": [self.original_image_width, self.original_image_height],
"original_image_location": [self.original_image_x, self.original_image_y],
"prompt": self.prompt,
"negative_prompt": self.negative_prompt,
"num_images": self.num_images
Expand All @@ -970,7 +982,7 @@ async def process(self, context: ProcessingContext) -> ImageRef:

@classmethod
def get_basic_fields(cls):
return ["image", "canvas_size", "prompt"]
return ["image", "canvas_width", "canvas_height", "prompt"]

class BriaBackgroundRemove(FALNode):
"""
Expand Down

0 comments on commit 36df55f

Please sign in to comment.