From 6bd677588b07320d40bb9c6ed7b869d540c7db61 Mon Sep 17 00:00:00 2001 From: Bruno Madeira Date: Mon, 22 Sep 2025 21:20:32 +0100 Subject: [PATCH] update README.md forgot to save the file... --- README.md | 68 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index ec2cab2..4c33da4 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,66 @@ # ComfyUI Panels -This packages contains nodes for generating and-or organizing comics-manga like panels, similarly to the ones below (_images contain the workflow_). +This packages contains nodes for generating and-or organizing comics-manga like panels, such as the ones below (_images have the workflow embedded_). -drawing -drawing +drawing +drawing ## Panel Layouts -Panel Layouts are an abstract hierarchical representation of a series of cuts made on a page in order to create the comics-manga panels. +Panel Layouts are abstract hierarchical representations of a series of cuts made on a page to create comic or manga panels. -Starting with an empty page (a single full-page panel), a single cut, or multiple equally spaced cuts, divide this page into distinct panels. -Following cuts are made to existing panels, and these cuts can be nested to an arbitrary level of complexity. +The process begins with an empty page (a single full-page panel). Initial cuts—whether single or multiple equally spaced ones—divide this page into distinct panels. Subsequent cuts are applied to existing panels and can be nested to achieve arbitrary levels of complexity. Cuts are defined by: -- direction — horizontal or vertical. -- position — from a selection of 5 potential relative positions to the panel being cut. -- angle — a slight deviation from the defined direction for aesthetic purposes. -- number of cuts — only applicable for one of the available relative positions, where the cuts will be forced to have the same spacing between each other. +- **Direction** — horizontal or vertical +- **Position** — selected from 5 potential relative positions to the panel being cut +- **Angle** — a slight deviation from the defined direction for aesthetic purposes +- **Number of cuts** — only applicable for one relative position option, where cuts are forced to have equal spacing -Some layouts are provided in the [sample_layouts](sample_layouts) folder, but you can create your own and store them using the *Save Panel Layout* node. +Sample layouts are provided in the [sample_layouts](sample_layouts) folder, but you can create and store your own using the **Save Panel Layout** node. -The image below is from one of the sample layouts. +The image below shows one of the sample layouts: -drawing +Sample panel layout -A Panel Layout does **NOT** store any particularaties regarding its panels, such as: corner shape, margins relative to the page's borders, line thickness or lack thereof, etc. -It can, however, implicitly define relative spacing between panels via the order of the cuts, but not the concrete values. +A Panel Layout does **NOT** store specific panel properties such as: +- Corner shape +- Margins relative to page borders +- Line thickness or style -The order of the layout's panels, and their relative spacing, is defined by the order of the cuts. -The first cut(s) will have a bigger margin, suggesting a reading direction parallel to the cut for the nested panels. -**The panel order is defined with this suggestion in mind**; -to deviate from this pattern you need to change the panels, or their order, separately from the layout. +However, it can implicitly define relative spacing between panels through the order of cuts, though not with concrete values. -When saving, previewing, or processing, a layout you have the option to do it from left-to-right or from right-to-left. -These options do not change the underlying data — you can use a layout saved as left-to-right as a right-to-left layout — the option only exists to help you keep things visually coherent with respect to your reading direction. +The order of panels (annotated with number stamps) is determined by the cut sequence. By default, this order also defines relative spacing between panels. The first cut(s) create larger margins, suggesting a reading direction parallel to the cut for nested panels, which are visually grouped due to having smaller margins. **The panel order aligns with this visual suggestion**—to deviate from this pattern, you must modify the panels or their order separately from the layout. + +Cuts and panel order diagram + +When saving, previewing, or processing a layout, you can choose between left-to-right or right-to-left orientations. These options don't change the underlying data—a layout saved as left-to-right can be used as right-to-left—but help maintain visual coherence with your preferred reading direction. -## Panel Layouts +## Panels +Panels are represented as `shapely.Polygon` objects, defining the concrete shape of each panel on the canvas. + +To extract panels from a layout, use the **Build Layout Panels** node. + +These panels can be modified using the following nodes: +- **Rotate Polygon** +- **Scale Polygon** +- **Translate Polygon** +- **Bevel Polygon** +- **Offset Polygon Bounds** + +Panel preview example + +Once a polygon is adjusted as desired, you can convert it into a mask using one of these nodes: +- **Panel to Mask** +- **Polygon To Resized Mask** (recommended when used with the **Paste Crops with Masks** node) + +To better understand the differences and potential uses of these nodes, refer to the example [workflows](workflows). + +Using the **Draw Panels Edges** node, you can generate an image with panel outlines to clearly separate them from the rest of the page content. + +As you may have noticed, panels are sometimes referred to as "polygons" in the node names and outputs. +This dual naming, though potentially confusing, is intentional: nodes and outputs using the "polygon" nomenclature are designed for broader compatibility with other packages that may also use `shapely.Polygon` objects. \ No newline at end of file