aicommunicator 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/LICENSE +55 -0
  2. package/README.md +93 -2
  3. package/bin/aic.js +20427 -0
  4. package/host-ui/host.js +5151 -0
  5. package/host-ui/index.html +483 -0
  6. package/host-ui/lang-en.js +631 -0
  7. package/package.json +30 -4
  8. package/plugin-guide.md +997 -0
  9. package/plugins/plugin-animation/LICENSE +55 -0
  10. package/plugins/plugin-animation/dist/logic.js +2225 -0
  11. package/plugins/plugin-animation/docs/manual.md +217 -0
  12. package/plugins/plugin-animation/manifest.json +31 -0
  13. package/plugins/plugin-animation/ui/icon.svg +6 -0
  14. package/plugins/plugin-animation/ui/index.html +2266 -0
  15. package/plugins/plugin-html-design/LICENSE +55 -0
  16. package/plugins/plugin-html-design/dist/logic.js +972 -0
  17. package/plugins/plugin-html-design/docs/manual.md +100 -0
  18. package/plugins/plugin-html-design/manifest.json +39 -0
  19. package/plugins/plugin-html-design/samples/exhibition-page.json +570 -0
  20. package/plugins/plugin-html-design/ui/icon.svg +5 -0
  21. package/plugins/plugin-html-design/ui/index.html +1241 -0
  22. package/plugins/plugin-html-slides/LICENSE +55 -0
  23. package/plugins/plugin-html-slides/dist/logic.js +1323 -0
  24. package/plugins/plugin-html-slides/docs/manual.md +121 -0
  25. package/plugins/plugin-html-slides/manifest.json +39 -0
  26. package/plugins/plugin-html-slides/samples/first-week-lecture.json +1129 -0
  27. package/plugins/plugin-html-slides/ui/icon.svg +5 -0
  28. package/plugins/plugin-html-slides/ui/index.html +1349 -0
  29. package/plugins/plugin-mindmap/LICENSE +55 -0
  30. package/plugins/plugin-mindmap/dist/logic.js +966 -0
  31. package/plugins/plugin-mindmap/docs/manual.md +145 -0
  32. package/plugins/plugin-mindmap/manifest.json +39 -0
  33. package/plugins/plugin-mindmap/samples/book-club.json +480 -0
  34. package/plugins/plugin-mindmap/ui/icon.svg +5 -0
  35. package/plugins/plugin-mindmap/ui/index.html +1774 -0
  36. package/plugins/plugin-plan/LICENSE +55 -0
  37. package/plugins/plugin-plan/dist/logic.js +1029 -0
  38. package/plugins/plugin-plan/docs/manual.md +261 -0
  39. package/plugins/plugin-plan/manifest.json +51 -0
  40. package/plugins/plugin-plan/samples/kimchi-day.json +1514 -0
  41. package/plugins/plugin-plan/samples/meeting-outline.json +653 -0
  42. package/plugins/plugin-plan/samples/reading-class.json +1577 -0
  43. package/plugins/plugin-plan/ui/icon.svg +7 -0
  44. package/plugins/plugin-plan/ui/index.html +1523 -0
  45. package/plugins/plugin-png/LICENSE +55 -0
  46. package/plugins/plugin-png/dist/logic.js +1758 -0
  47. package/plugins/plugin-png/docs/manual.md +344 -0
  48. package/plugins/plugin-png/manifest.json +35 -0
  49. package/plugins/plugin-png/ui/icon.svg +5 -0
  50. package/plugins/plugin-png/ui/index.html +2885 -0
  51. package/plugins/plugin-process-log/LICENSE +55 -0
  52. package/plugins/plugin-process-log/dist/logic.js +406 -0
  53. package/plugins/plugin-process-log/docs/manual.md +131 -0
  54. package/plugins/plugin-process-log/manifest.json +43 -0
  55. package/plugins/plugin-process-log/samples/design-decisions.json +241 -0
  56. package/plugins/plugin-process-log/ui/icon.svg +7 -0
  57. package/plugins/plugin-process-log/ui/index.html +721 -0
  58. package/plugins/plugin-story/LICENSE +55 -0
  59. package/plugins/plugin-story/dist/logic.js +2201 -0
  60. package/plugins/plugin-story/docs/manual.md +428 -0
  61. package/plugins/plugin-story/manifest.json +49 -0
  62. package/plugins/plugin-story/samples/scene-body.json +758 -0
  63. package/plugins/plugin-story/samples/time-and-groups.json +989 -0
  64. package/plugins/plugin-story/ui/icon.svg +4 -0
  65. package/plugins/plugin-story/ui/index.html +2783 -0
  66. package/plugins/plugin-svg/LICENSE +55 -0
  67. package/plugins/plugin-svg/dist/logic.js +2150 -0
  68. package/plugins/plugin-svg/docs/manual.md +314 -0
  69. package/plugins/plugin-svg/manifest.json +45 -0
  70. package/plugins/plugin-svg/samples/rocket-icon.json +1305 -0
  71. package/plugins/plugin-svg/samples/yard-cat.json +7796 -0
  72. package/plugins/plugin-svg/ui/icon.svg +4 -0
  73. package/plugins/plugin-svg/ui/index.html +2017 -0
  74. package/plugins/plugin-tree/LICENSE +55 -0
  75. package/plugins/plugin-tree/dist/logic.js +505 -0
  76. package/plugins/plugin-tree/docs/manual.md +140 -0
  77. package/plugins/plugin-tree/manifest.json +45 -0
  78. package/plugins/plugin-tree/samples/book-club.json +473 -0
  79. package/plugins/plugin-tree/samples/sort-memos.json +604 -0
  80. package/plugins/plugin-tree/ui/icon.svg +7 -0
  81. package/plugins/plugin-tree/ui/index.html +1305 -0
  82. package/schema/aic_describe.input.json +11 -0
  83. package/schema/aic_describe.output.json +67 -0
  84. package/schema/aic_observe.input.json +14 -0
  85. package/schema/aic_observe.output.json +47 -0
  86. package/schema/aic_send.input.json +15 -0
  87. package/schema/aic_send.output.json +38 -0
  88. package/schema/aic_update.input.json +19 -0
  89. package/schema/aic_update.output.json +39 -0
  90. package/schema/common.json +127 -0
  91. package/template/plugin/LICENSE +55 -0
  92. package/template/plugin/README.md +27 -0
  93. package/template/plugin/docs/manual.md +31 -0
  94. package/template/plugin/logic.js +337 -0
  95. package/template/plugin/manifest.json +27 -0
  96. package/template/plugin/ui/icon.svg +4 -0
  97. package/template/plugin/ui/index.html +269 -0
@@ -0,0 +1,344 @@
1
+ # PNG Image manual
2
+
3
+ This is the detailed manual that you and the AI read together. You open it with [설명서] (Manual) in the plugin window of the AIC screen, and the AI reads it with `read_plugin_manual`. The short instructions the AI follows while it works are in `describe_document` of a work that has this screen.
4
+
5
+ ## What this screen does
6
+
7
+ You and the AI look at one PNG picture, such as a photo or a drawing, and edit it together. You select the part to change in fine detail and lift it off as a **piece**. Then you move, scale, rotate, recolor or erase each piece. Once a piece is lifted and named, you can click to select it on its own, and the AI refers to it by its id too. You save the result as a PNG file.
8
+
9
+ This screen fits jobs like these.
10
+
11
+ - Change the colors of only one part of a picture. For example: "Make only this envelope green", "Make the background a little darker".
12
+ - Lift one object off and move, scale or rotate it. For example: "Tilt the leaf a little more".
13
+ - Erase parts you do not need to transparency, or crop the picture to keep only what you need.
14
+ - Add other PNG pictures as pieces and gather them into one picture.
15
+
16
+ Some things are not on this screen. There is no brush drawing, no adding text, no effects such as blur, and no filling in the empty area left after lifting. The only image files it accepts are PNG. To draw or edit an icon made of shapes, the SVG Image plugin fits better.
17
+
18
+ ## What a picture is made of
19
+
20
+ | Term | Meaning |
21
+ | --- | --- |
22
+ | Canvas | There is one per work. Its id looks like `cv1`. If you start from an image file, the canvas has that picture's size, and cropping changes it. Width and height are integers from 1 to 4096 |
23
+ | Image file | One PNG file that you added. Its id looks like `im1`. After it is added, its pixels do not change |
24
+ | Piece | Something that shows part of an image file. Its id looks like `pc1`. When you add a picture, a first piece that shows the whole picture is made, and each lift makes a new piece. Pieces are drawn from bottom to top, overlapping |
25
+ | Region | A place on the canvas that you named and kept. Its id looks like `rg1`. The picture does not change. It lets you and the AI refer to the same place in later conversations too |
26
+ | Section | A rectangle made by splitting the canvas into four, again and again. The whole canvas is `q`, and deeper sections are written like `q.2.3`. The AI uses them to look at one part of a large picture up close and to say where something is (see the "Sections" chapter below) |
27
+
28
+ All positions are canvas pixels. x grows to the right and y grows downward, and (0, 0) is the top left of the canvas. Rotation is in degrees, clockwise.
29
+
30
+ **Once you know what a piece is, this screen gets easy.** The original pixels stay exactly as they were added. Each piece only records which part of the image file is visible, which parts are erased, where and how it is placed, and how its colors are adjusted. A lifted piece also points to the same image file, and only its visible part is different. So you can undo any edit at any time, and you can restore erased areas too.
31
+
32
+ ## Getting started
33
+
34
+ When there is no picture, a large box appears in the middle. There are four ways to add a picture, and you do all of them yourself.
35
+
36
+ 1. **Choose a file**: Click the box or press [Choose file], then choose a PNG file.
37
+ 2. **Drag and drop**: Drag a PNG file from your file explorer and drop it on the box.
38
+ 3. **Paste**: Copy a picture first, then press Ctrl+V on the screen.
39
+ 4. **Sample**: Press [Start with sample] to start with the built-in sample "Apple". It is a 64×64 picture of one apple on a transparent background. The body, highlight, stem and leaf are each one flat color, so it suits a quick try of lifting and adjusting colors.
40
+
41
+ **The AI cannot add image files.** To send an image file in an operation, the AI would have to write the whole file as text (base64), and even a PNG of ordinary size goes over one million characters. For example, a 1.1MB picture of 1254×1254 is about 1.5 million characters. So you add pictures on the screen, and the AI starts only with a sample or an empty canvas, and only when you want that (`sample` of `canvas.start`, or `width` and `height`). If the AI started with an empty canvas, you add a picture as a piece with [Add picture].
42
+
43
+ After there is a picture, if you drop or paste a PNG file onto the picture area, that picture goes on top as a new piece. [Add picture] in the top bar does the same.
44
+
45
+ ## A tour of the screen
46
+
47
+ To give the picture most of the screen, things that do not always need to be visible are hidden, and you open them when you need them. Hover over an icon to see its name and what it does.
48
+
49
+ **Top bar**
50
+
51
+ From left to right, it has these.
52
+
53
+ - **Six tools**: [Select piece], [Rectangle], [Ellipse], [Freehand], [Similar colors], [Move view]. The chosen tool is filled with color.
54
+ - **Zoom**: The zoom level shows between [Zoom out] and [Zoom in], and [Fit to screen] next to them fits the whole canvas into the picture area.
55
+ - **Canvas size**: Always visible, like "64×64". Hover over it to see the numbers of pieces, regions and image files.
56
+
57
+ On the right are these.
58
+
59
+ - **[Select] menu**: [Invert], [Deselect], [Grow], [Shrink], the pixels to grow or shrink, the similar colors tolerance, "Connected only (off: whole picture)", and "Show regions".
60
+ - **[Add picture]**: Adds another PNG file as a new piece on top.
61
+ - **[Save] menu**: Choose the PNG size and press [Save PNG].
62
+ - **[Tool help]**: When it is on, what the current tool does and how to move the view appear below the picture.
63
+ - **[Pieces and info]**: Opens and closes the right panel.
64
+
65
+ A menu closes when you click somewhere else or press Esc. On a view-only screen, "View only" appears in this bar.
66
+
67
+ **Picture area**
68
+
69
+ The canvas is drawn on a checkerboard pattern, so transparent areas are visible. Use the mouse wheel to zoom in and out. To move the view, drag with the [Move view] tool, or with any tool, drag while holding the middle mouse button or Space. The selected area shows as a semi-transparent color with an outline. Selected pieces show as an outline around the area they take up, with a name label. When "Show regions" is on, named regions show as outlines.
70
+
71
+ **Panel that appears after you select**
72
+
73
+ When you select something, a panel appears at the top of the picture, right below the toolbar, and it disappears when you deselect. If the selection is near the top and the panel would cover it, the panel appears near the bottom instead. The first line says what you selected.
74
+
75
+ - **If you selected an area**: There are [Lift], [Copy], [Erase], [Crop] and [Adjust colors], and below them a message box, [Send to AI] and [×].
76
+ - **If you selected pieces or a point**: There are a message box, [Send to AI] and [×].
77
+ - In the list before the message box, choose "Change this" if it is a place to change, or "For reference" if it is an example to compare with.
78
+ - This panel does not appear on a view-only screen.
79
+
80
+ **Right panel**
81
+
82
+ It starts hidden, and you open it with [Pieces and info]. From top to bottom, it has these.
83
+
84
+ - **Picture**: The canvas size, what the picture started from, and the numbers of pieces, regions and image files.
85
+ - **Selection**: If you selected an area, it shows how you selected it, the bounding box, the number of pixels, the pieces visible there, and the main colors. Type a name and press [Name region] to keep the selected area as a region.
86
+ - **Piece values**: Shown when you select one piece. There are the name and [Rename], Move x and Move y, Horizontal scale and Vertical scale, Rotation (degrees, clockwise), the color controls Hue, Saturation, Brightness, Tint color, Tint and Opacity, and [Restore erased]. A number box is sent as soon as you change it. A slider shows a preview only on the screen while you drag it, and it is sent when you let go. Scale and rotation use the center of the area the piece takes up as their base.
87
+ - **Piece list**: What is drawn on top comes first. Click a name to select that piece. Each row has buttons to hide or show, move up, move down, and delete.
88
+ - **Region list**: [Select region] selects that region again, and the delete button deletes it.
89
+ - **Image files**: The file name, the size, and the number of pieces that use that file.
90
+
91
+ **Keyboard**
92
+
93
+ In the picture area, Esc deselects, `+` and `-` zoom in and out, and `0` fits the canvas to the screen. Drag while holding Space to move the view.
94
+
95
+ ## Selecting
96
+
97
+ You can select three kinds of things: an **area** of the picture, a **piece** that was already lifted, and a **point**.
98
+
99
+ | Tool | What it does |
100
+ | --- | --- |
101
+ | [Rectangle] | Drag to select a rectangle |
102
+ | [Ellipse] | Drag to select an ellipse |
103
+ | [Freehand] | Hold the button down and draw around something to select the inside |
104
+ | [Similar colors] | Selects colors similar to the spot you click |
105
+ | [Select piece] | Click a piece to select it, or drag to move it |
106
+ | [Move view] | Drag to move the view |
107
+
108
+ **Adding to and subtracting from the selection.** With [Rectangle], [Ellipse], [Freehand] and [Similar colors], hold Shift while selecting to add to the selected area, or hold Alt to subtract from it. You can mix several tools to add and subtract.
109
+
110
+ **Refining with the [Select] menu.** [Invert] swaps the selected and unselected areas. If nothing is selected, it selects the whole canvas. If you select only the background and invert, only the object is selected. [Grow] and [Shrink] move the edge of the selected area outward or inward by the number of pixels in the box next to them (1 to 200). [Deselect] clears the selection (the same as Esc).
111
+
112
+ **Selecting similar colors.** It selects from the pixels of the picture as it looks now, that is, the picture drawn from all pieces together. The tolerance is 0 to 255, and it starts at 32. The higher it is, the more different colors are selected together. When "Connected only" is on, it selects only pixels connected to the spot you clicked. When it is off, it selects all similar colors in the whole picture. You set both in the [Select] menu, and you see the current values when you hover over the [Similar colors] tool.
113
+
114
+ **Selecting a point.** With [Rectangle], [Ellipse] or [Freehand], click once without dragging. This selects the position and color of that point and the topmost piece visible there.
115
+
116
+ **Selecting pieces.** Click with [Select piece] to select the topmost piece that has a visible pixel where you clicked. Transparent areas do not take the click, and the piece visible below is selected instead. Hold Shift (or Ctrl, or Command on a Mac) and click to add or remove pieces. You can select up to 200 pieces together. When you drag selected pieces, they move together and are saved as one operation, so undo also brings them back together. You can also click in the piece list of the right panel to select.
117
+
118
+ **Selecting a region again.** Press [Select region] in the region list of the right panel to select the kept shape again.
119
+
120
+ ## Lifting into pieces and editing them
121
+
122
+ ### Lift and copy
123
+
124
+ Select an area and press a button in the panel that appears. The button works on the topmost piece actually visible in the selected area.
125
+
126
+ - **[Lift]**: Makes the selected area a new piece and erases that part of the original piece (cut). When you move the new piece, the original place looks empty and transparent.
127
+ - **[Copy]**: Makes the selected area a new piece and leaves the original piece as it is (copy). When you move the new piece, the same picture stays in the original place.
128
+
129
+ The new piece goes right above the original piece, with the same placement and the same color adjustments. After lifting, the tool switches to [Select piece] and the new piece is selected, so you can drag it right away.
130
+
131
+ ### Changing the colors of only one area
132
+
133
+ Color adjustments apply to a whole piece. So to change the colors of only one area, **copy** that area into a new piece and change the new piece's colors. [Adjust colors] in the panel does this in one step. It copies the selected area into a new piece, opens the right panel, and shows the color sliders of the new piece.
134
+
135
+ There is a reason to copy instead of cut. In a cut piece, semi-transparent pixels at the edge are not fully covered, so gaps can show through.
136
+
137
+ There are five color adjustments. Hue turns colors by degrees (-180 to 180, 0 means unchanged). Saturation is 0 to 2 (1 means unchanged, 0 means gray). Brightness is 0 to 2 (1 means unchanged). Tint lays one chosen color over the piece by an amount from 0 to 1. Opacity is 0 to 1.
138
+
139
+ ### Erase and crop
140
+
141
+ - **[Erase]**: Erases the selected area to transparency in the topmost visible piece. [Restore erased] in the right panel restores all erased areas of that piece.
142
+ - **[Crop]**: Crops the canvas to the rectangle around the selected area. The positions of pieces and regions are shifted by the same amount, so the visible picture stays the same except for the part cut off. To extend the canvas outward, ask the AI (it gives `canvas.crop` a rectangle larger than the canvas).
143
+
144
+ ### Move, scale, rotate, stacking order, hide, name
145
+
146
+ - **Move**: Drag with [Select piece], or type Move x and Move y in the right panel.
147
+ - **Scale and rotate**: Type Horizontal scale, Vertical scale and Rotation in the right panel. A negative scale flips the piece. To stretch it while one end stays in place, ask the AI to give a pivot (`pivot`).
148
+ - **Stacking order**: Press the move up and move down buttons in the piece list.
149
+ - **Hide**: Press the eye icon in the piece list. A hidden piece is not in the picture or in the saved file.
150
+ - **Name**: Select one piece, type the name in the right panel, and press [Rename].
151
+ - **Delete a piece**: Press the delete button in the piece list. If no other piece uses that image file, the image file is deleted too.
152
+
153
+ ## Working with the AI
154
+
155
+ ### How the AI knows what you selected
156
+
157
+ There are two ways.
158
+
159
+ 1. **Just select, then talk in the chat.** When you say "this" or "the selected area", the AI reads the current selection with `read_selection`. But selecting alone does not notify an AI that is waiting.
160
+ 2. **Press [Send to AI].** The selection and the text in the message box go to the AI, and an AI that is watching the screen and waiting knows right away. The message can be empty, and pressing Enter in the message box also sends it. After sending, the panel shows the selection id, like "Sent to the AI (selection sel3)".
161
+
162
+ If the host cannot receive selections that you have not sent, the panel shows "Not sent to the AI yet." Then the AI knows about the selection only after you send it.
163
+
164
+ **An area selected by pixels, such as with similar colors, must be sent so the AI can edit that exact shape.** An area selected with a single rectangle, ellipse or freehand shape goes to the AI as numbers, so the AI can copy it into an operation. An area selected with similar colors, or by adding and subtracting several times, is a pixel shape and cannot be turned into numbers. If you only select it, the AI knows only the bounding box, the number of pixels, the main colors and the visible pieces, and it can only edit roughly by the bounding box. When you press [Send to AI], the screen first saves that shape as an **automatic region** and sends its region id. The AI uses that region id to lift or erase that exact shape. Automatic regions appear in the right panel as "Sent area", and only five are kept. When you send a sixth, the oldest one is deleted. For an area you will use for a long time, ask the AI to give it a name. Once it has a name, it is no longer an automatic region.
165
+
166
+ ### The order in which the AI works
167
+
168
+ 1. **It looks at the picture with `read_image`.** The AI cannot read pixels as text, so this is its main way to know the picture. It gets the picture at 16 to 1024 pixels on the longest side, or 512 if it leaves the size out. For details of a large picture, it gets only one section or one piece up close (see the "Sections" chapter below).
169
+ 2. **It reads what you selected with `read_selection`.** This gives the position, size, main colors, the pieces and regions it overlaps, and the section that contains all of it.
170
+ 3. **It reads ids with `read_concept`.** This gives the canvas size, the image files, the pieces (bottom to top) and the regions. The "area it takes up" of a piece is an estimate that includes transparent pixels, so it can be larger than what is actually visible.
171
+ 4. **It lifts the object to edit into a piece, then edits that piece.** To move one object on its own or change its colors, it first lifts it with `piece.lift`.
172
+ 5. **It looks at the result again with `read_image`.**
173
+
174
+ The shapes the AI can select by itself are rectangles, ellipses and polygons. For areas that must be selected exactly by color (fur, hair, objects with complex edges), the AI asks you to select them on the screen with [Similar colors] and press [Send to AI]. When the AI lifted something roughly, it checks the result with `read_image` after lifting.
175
+
176
+ The AI asks you first in these cases.
177
+
178
+ - What to start with when there is no picture. You add image files, and the AI starts with a sample or an empty canvas only when you want that.
179
+ - When it must edit an area that has to be selected exactly by color. It asks you to select the area on the screen and send it.
180
+ - When it must edit the exact shape of an area you selected by pixels but did not send. It asks you to press [Send to AI].
181
+
182
+ ### Examples of what you can say
183
+
184
+ - "Lift the selected area and move it 20 pixels to the right."
185
+ - "Make just this piece a little brighter."
186
+ - "Change only the colors of the sent area toward blue." (after you select with [Similar colors] and send)
187
+ - "Erase the background to transparency. I will select the background with similar colors and send it."
188
+ - "Keep only the apple in the middle and crop away the edges."
189
+ - "Name this place 'left eye'."
190
+
191
+ ### Examples of operations the AI sends
192
+
193
+ The examples below are operations that are accepted as they are when you send them in order from the top, on a picture started with the built-in sample "Apple" (64×64). The first piece is `pc1`, the leaf made in the first example is `pc2`, the body in the second example is `pc3`, and `rg1` in the third example is a region kept before that. A piece made new in one request gets a name with `"as": "$name"`, and later operations in the same request refer to it as `$name`.
194
+
195
+ Cut out the leaf and tilt it by 20 degrees.
196
+
197
+ ```json
198
+ [
199
+ { "op": "piece.lift", "as": "$leaf", "input": { "where": { "ellipse": [41, 15, 11, 7] }, "from": "pc1", "name": "leaf" } },
200
+ { "op": "piece.place", "input": { "piece": "$leaf", "rotate": -20 } }
201
+ ]
202
+ ```
203
+
204
+ Copy the body into a new piece and turn only that piece's hue. The original piece stays as it is.
205
+
206
+ ```json
207
+ [
208
+ { "op": "piece.lift", "as": "$body", "input": { "where": { "ellipse": [32, 39, 24, 18] }, "from": "pc1", "cut": false, "name": "body" } },
209
+ { "op": "piece.adjust", "input": { "piece": "$body", "hue": 100 } }
210
+ ]
211
+ ```
212
+
213
+ Copy region `rg1` in its exact shape (the same works for an automatic region you sent), and erase one area.
214
+
215
+ ```json
216
+ [
217
+ { "op": "piece.lift", "input": { "where": "rg1", "from": "pc1", "cut": false, "name": "stem" } },
218
+ { "op": "piece.erase", "input": { "where": { "rect": [28, 6, 8, 6] }, "piece": "pc1" } }
219
+ ]
220
+ ```
221
+
222
+ Stretch one piece 1.5 times vertically only, with its top end as the pivot. Then change another piece's colors to gray and lay a little blue over it.
223
+
224
+ ```json
225
+ [
226
+ { "op": "piece.place", "input": { "piece": "pc2", "scale": [1, 1.5], "pivot": [41, 8] } },
227
+ { "op": "piece.adjust", "input": { "piece": "pc3", "saturate": 0, "tint": { "color": "#3366cc", "amount": 0.4 } } }
228
+ ]
229
+ ```
230
+
231
+ The values of `piece.place` and `piece.adjust` set a value. They are not added to the old value. If you send `scale: 1.2` twice, the result is still 1.2 times. If no pivot is given, the pivot is set to the center of the area the piece takes up the first time it is rotated or scaled. The pivot is a position inside the piece, that is, a pixel position in the image file. In contrast, `where` is given as the position visible on the canvas now, even if the piece has been moved or rotated.
232
+
233
+ ## Sections
234
+
235
+ A section is a rectangle made by splitting the canvas into four. The whole canvas is `q`. The top left is `q.1`, the top right is `q.2`, the bottom left is `q.3`, and the bottom right is `q.4`. When a section is split into four again, the parts are joined with dots, like `q.2.3`. Splitting stops before a side gets smaller than 64 pixels. So the 64×64 apple sample has only `q`, and the larger the picture, the deeper it is split.
236
+
237
+ Sections are how the AI looks at a large picture. There is a limit to how large a picture the AI can make out at once. So it looks at the whole picture scaled down, and goes down into lower sections for details. Whichever section it reads, it gets one picture of the same size, so a larger picture only means more levels.
238
+
239
+ - Give `view` to `read_image` to look at one section up close (see "Looking at one part of the picture up close" below).
240
+ - The description from `read_selection` names the smallest section that contains the whole selected area.
241
+ - Give a section id as the scope of `read_concept` to read only the pieces and regions that overlap that section. Give a piece id or a region id to read that item in detail, including its shape. You can give up to 20 at once.
242
+ - Sections are not used as `where`. Give the section's rectangle as `{ "rect": [x, y, w, h] }`.
243
+
244
+ ### Looking at one part of the picture up close
245
+
246
+ The AI gives a view (`view`) to `read_image` to get only one part of the picture. `size` (the longest side, up to 1024) applies to that part, so the part shows in more detail. Without `view`, the AI gets the whole picture.
247
+
248
+ | View | What it shows |
249
+ | --- | --- |
250
+ | `{ "piece": "q.2.3" }` | One section. `q` is the whole picture |
251
+ | `{ "piece": "pc2" }` | The area that piece takes up, showing the picture as it looks there |
252
+ | `{ "piece": "pc2", "alone": true }` | Only that piece. Other pieces are left out, and it shows even if it is hidden |
253
+ | `{ "region": "rg1" }` | The place where the saved region is |
254
+ | `{ "region": "rg1", "mark": true }` | The picture with the region's shape painted over in pink. Use it to see where the area you selected is |
255
+ | `{ "region": { "x": 100, "y": 40, "w": 200, "h": 120 } }` | One rectangle of the canvas |
256
+
257
+ - In any view, give `margin` (0 to 512) to show that much more around it.
258
+ - Give only one of `piece` and `region`. Use `alone` only with a piece id, and `mark` only with a region id.
259
+ - A section, piece or region that does not exist, or a rectangle outside the canvas, is rejected with the reason. A wrong view is never ignored to show the whole picture instead.
260
+
261
+ When the AI edits the overall shape, it first looks at the whole shape in an upper section, then goes down to lower sections to check details, and after editing it looks again from the upper section. It is like a person drawing who steps back to see the whole and steps closer to see the details.
262
+
263
+ ## Saving
264
+
265
+ Open the [Save] menu in the top bar, choose a size, and press [Save PNG].
266
+
267
+ - The size list has 1x, 2x, 4x and 8x of the canvas size, like "64×64 (original size)" and "128×128 (2x)", plus "Longest side 256", "Longest side 512" and "Longest side 1024". A multiple whose longest side falls outside 16 to 4096 pixels is not shown. The original size is chosen at first.
268
+ - Transparent areas stay transparent. Erased areas, empty areas left by lifting, and areas added by extending the canvas are all transparent. Hidden pieces are not included.
269
+ - The file name is the name of the first image file without its extension (`picture` if there is none), followed by the size in pixels.
270
+ - This button shows only when the core can make PNG. Otherwise, the menu shows "This core version does not support saving PNG yet".
271
+
272
+ There is no button to save as an SVG file. An SVG that holds image files easily gets too large, and the output of a screen that edits PNG is PNG.
273
+
274
+ ## Operation table
275
+
276
+ The input structure and examples of operations are also in `describe_document`. `where` is one of a region id (`"rg3"`), `{ "rect": [x, y, w, h] }`, `{ "ellipse": [cx, cy, rx, ry] }` and `{ "polygon": [[x, y], ...] }`, and all of them are canvas positions. `{ "mask": ... }` is used only when the screen sends a shape selected by pixels.
277
+
278
+ | Operation | Input | What it does |
279
+ | --- | --- | --- |
280
+ | `canvas.start` | `sample`, `width`, `height`, `image`, `reason` | Makes the canvas. This is done only once. Give one of `sample`, `image`, or `width` and `height`. Starting from an image file makes a canvas of that size and a first piece that shows the whole picture. `image` is a PNG file you added on the screen, and the AI does not use it |
281
+ | `canvas.crop` | `where`, or `x, y, width, height` | Crops the canvas. The positions of pieces and regions are shifted by the same amount, so the visible picture stays the same except for the part cut off. It can also extend the canvas beyond its edges |
282
+ | `piece.add` | `image`, `name`, `move` | Adds another image file as a new piece on top. Your screen sends this operation |
283
+ | `piece.lift` | `where`, `from`, `cut`, `name` | Lifts that area of a piece into a new piece. The new piece goes right above the original piece, with the same image file, the same placement and the same color adjustments. If `cut` is left out, it cuts, and if it is `false`, it copies. If `from` is left out, a piece is chosen only when exactly one visible piece overlaps that area |
284
+ | `piece.erase` | `where`, `piece` | Erases that area to transparency. If `piece` is left out, it erases from all visible pieces that overlap that area |
285
+ | `piece.unerase` | `piece` | Restores all erased areas of that piece |
286
+ | `piece.place` | `piece`, `move`, `rotate`, `scale`, `pivot` | Sets the placement. Only the given fields change, and the values set a value instead of adding to it |
287
+ | `piece.adjust` | `piece`, `hue`, `saturate`, `brightness`, `tint`, `opacity` | Sets the color adjustments of the whole piece. Only the given fields change, and the values set a value. To change only one area, lift that area with `cut: false` and change that piece |
288
+ | `piece.set` | `piece`, `name`, `hidden` | Names or hides a piece |
289
+ | `piece.order` | `piece`, `above`, `below`, `to` | Changes the stacking order. Give one of `above`, `below` and `to`. `to` is `"top"` or `"bottom"` |
290
+ | `piece.remove` | `piece` | Deletes a piece. If no other piece uses that image file, the image file is deleted too |
291
+ | `region.add` | `where`, `name`, `note`, `auto` | Names an area and keeps it. The picture does not change. In later conversations too, give the region id as `where` to refer to the same area. `auto` is used only when the screen saves a selected area in order to send it |
292
+ | `region.set` | `region`, `name`, `note` | Changes a region's name or note. Giving it a name removes it from the automatic regions |
293
+ | `region.remove` | `region` | Deletes a region |
294
+
295
+ ## Limits
296
+
297
+ | What | Limit |
298
+ | --- | --- |
299
+ | One image file | 4MB (4,194,304 bytes), longest side 4096 pixels, PNG only |
300
+ | Canvas | Width and height are integers from 1 to 4096 |
301
+ | Image files | 20 |
302
+ | Pieces | 200 |
303
+ | Regions | 200 (of these, up to 5 automatic regions are kept) |
304
+ | Lifts from one piece (shapes of its visible area) | 8 |
305
+ | Erased areas of one piece | 40 |
306
+ | Polygon corners | 3 to 400 |
307
+ | One shape selected by pixels | 800,000 characters |
308
+ | Total characters of image files and selected shapes | 7,000,000 characters |
309
+ | Piece name, region name | 80 characters |
310
+ | Note, reason for starting | 1,000 characters |
311
+ | Scale (`scale`) | 0.01 to 100 (a negative value flips) |
312
+ | Rotation (`rotate`) | -360 to 360 degrees |
313
+ | Pieces selected together | 200 |
314
+ | Scope of `read_concept` | 20 at a time |
315
+
316
+ ## Common problems
317
+
318
+ - **"Only PNG files are accepted. This file is a JPEG image" appears.** This screen accepts only PNG. Convert JPEG, WebP and GIF files to PNG in another program, then add them.
319
+ - **"The file is too large" or "The picture is too large" appears.** One file can be up to 4MB, and the longest side up to 4096 pixels. Make it smaller in another program, then add it.
320
+ - **Similar colors selects too much.** Lower the tolerance or turn on "Connected only". Subtract the extra areas by selecting them while holding Alt.
321
+ - **Similar colors selects too little.** Raise the tolerance, or hold Shift and click the missed spots to add them. If the edge is a little short, use [Grow].
322
+ - **"The selected shape is too large" appears.** A shape selected by pixels can be up to 800,000 characters. Select a smaller area, or select with a rectangle or freehand.
323
+ - **The lift and erase buttons are turned off.** No piece is visible in the selected area (it is a transparent area). Select a place where there is picture.
324
+ - **A notice appears after I delete the original piece.** A piece lifted from it still points to the original piece, so the response comes with a notice that the piece it pointed to was removed (`ref_target_removed`). The lifted piece uses the same image file, so it is still drawn. In `read_concept` it shows like "Lifted from pc1 (now removed)."
325
+ - **The screen says "View only" and has no buttons.** The AI is editing and holds the cursor, or this is not the screen being edited now. You can edit again after you press [가져오기] (Take back) at the top of the host screen, or when the AI finishes.
326
+ - **The AI reads "There is no picture yet" while the screen shows a picture.** The picture you just added is not in the AI's state yet. The AI does not start over. It merges your change with a request that has no operations, then reads again.
327
+ - **The AI is rejected with "Several visible pieces overlap the area".** Give the id of the piece to lift from in `from` of `piece.lift`.
328
+ - **"Cannot lift from this piece any more" appears.** You can lift from one piece up to 8 times. Lift from a larger piece (one that was there earlier).
329
+ - **You cannot erase more because the piece has 40 erased areas.** Restore the erased areas with `piece.unerase`, or lift the piece again. If you need to cut out more, lift with copy.
330
+ - **Gaps show at the edge of a cut piece.** If you only want to change colors, use [Copy] or [Adjust colors].
331
+ - **The original place is empty after lifting and moving.** The empty area left by lifting stays transparent and cannot be filled in. To keep the original as it is, lift with copy.
332
+ - **You want to select a piece that another piece covers.** Click it in the piece list of the right panel.
333
+ - **[Save PNG] is not visible.** The core is an old version that does not support saving PNG. The menu says why.
334
+
335
+ ## Not in the first version
336
+
337
+ - Brush drawing, adding text, effects such as blur, and filling in the empty area left by lifting.
338
+ - Selecting by color by the AI. You select by color on the screen.
339
+ - Accepting JPEG and WebP.
340
+ - Merging pieces and swapping an image file.
341
+ - Dragging handles to scale and rotate a piece. For now, you use the number boxes in the right panel.
342
+ - Softening the edge of the selected area.
343
+ - Saving as an SVG file.
344
+ - The AI adding image files from this computer by path, and exchanging pictures with image generation models. This will be decided after trying the plugin.
@@ -0,0 +1,35 @@
1
+ {
2
+ "id": "aic.png",
3
+ "version": "0.1.3",
4
+ "dataVersion": 1,
5
+ "title": "PNG Image",
6
+ "license": "Apache-2.0",
7
+ "protocol": "0.1",
8
+ "logic": "dist/logic.js",
9
+ "ui": "ui/index.html",
10
+ "icon": "ui/icon.svg",
11
+ "manual": "docs/manual.md",
12
+ "about": "A screen where you and the AI look at and edit one PNG picture, such as a photo or a picture made by an image generation model. You select precisely in the picture with a rectangle, an ellipse, a freehand outline or similar colors, and lift the selection out as a piece of its own. Each piece can be moved, scaled and rotated, have its hue, saturation and brightness changed or be tinted with one color, and be erased or hidden. A piece you have lifted and named can be selected with a click, and the AI points to it by that name. The original pixels are never changed and only the edits are stacked on top, so you can undo at any time. The AI sees the picture as a picture and reads the position and main colors of what you selected before editing. You load the picture file on the screen, and the result is saved as a PNG file.",
13
+ "requires": {
14
+ "os": "any",
15
+ "external": []
16
+ },
17
+ "examples": [
18
+ {
19
+ "ask": "In a generated picture, I want to move only the object the character is holding a little",
20
+ "does": "You select the object by similar colors and send it to the AI. The AI lifts it out as a piece in that exact shape, moves it, and checks the result as a picture."
21
+ },
22
+ {
23
+ "ask": "I want to change the color of only one part of the picture",
24
+ "does": "Select that part and press the color change button, or tell the AI. The part is copied into a piece and the hue or brightness of that piece is changed."
25
+ },
26
+ {
27
+ "ask": "I want to place something taken from another picture on top of this one",
28
+ "does": "You add another PNG file as a piece, and you or the AI adjust its position, size and stacking order."
29
+ },
30
+ {
31
+ "ask": "I want to crop the useless edges of the picture",
32
+ "does": "Select the area to keep and press crop, or the AI crops the canvas to a rectangle. The pieces keep their positions."
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
2
+ <rect x="2" y="2" width="20" height="20" rx="5" fill="#b7791f"/>
3
+ <circle cx="8.5" cy="8.5" r="2" fill="#ffffff"/>
4
+ <path d="M5.5 18l4.5-5.5 2.5 3 3-4 3 6.5z" fill="#ffffff" stroke="#ffffff" stroke-width="1.5" stroke-linejoin="round"/>
5
+ </svg>