pixeli 0.1.8 → 1.0.3

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 (204) hide show
  1. package/README.md +341 -88
  2. package/dist/cli/commands/collage/index.d.ts +2 -0
  3. package/dist/cli/commands/collage/index.js +125 -0
  4. package/dist/cli/commands/grid/index.d.ts +2 -0
  5. package/dist/cli/commands/grid/index.js +127 -0
  6. package/dist/cli/commands/masonry/index.d.ts +2 -0
  7. package/dist/cli/commands/masonry/index.js +129 -0
  8. package/dist/cli/commands/template/index.d.ts +2 -0
  9. package/dist/cli/commands/template/index.js +123 -0
  10. package/dist/cli/commands/template/presets/artGallery.d.ts +15 -0
  11. package/dist/cli/commands/template/presets/artGallery.js +15 -0
  12. package/dist/cli/commands/template/presets/dashboardShot.d.ts +15 -0
  13. package/dist/cli/commands/template/presets/dashboardShot.js +16 -0
  14. package/dist/cli/commands/template/presets/horizontalBookSpread.d.ts +15 -0
  15. package/dist/cli/commands/template/presets/horizontalBookSpread.js +13 -0
  16. package/dist/cli/commands/template/presets/instagramGrid.d.ts +15 -0
  17. package/dist/cli/commands/template/presets/instagramGrid.js +16 -0
  18. package/dist/cli/commands/template/presets/verticalBookSpread.d.ts +15 -0
  19. package/dist/cli/commands/template/presets/verticalBookSpread.js +13 -0
  20. package/dist/cli/commands/template/presets.d.ts +73 -0
  21. package/{lib/merges/collage-merge → dist/cli/commands/template}/presets.js +6 -8
  22. package/dist/cli/index.d.ts +2 -0
  23. package/dist/cli/index.js +24 -0
  24. package/dist/cli/modules/loadImages.d.ts +15 -0
  25. package/dist/cli/modules/loadImages.js +74 -0
  26. package/dist/cli/modules/progressBar.d.ts +10 -0
  27. package/dist/cli/modules/progressBar.js +34 -0
  28. package/dist/cli/schemas/collage.d.ts +29 -0
  29. package/dist/cli/schemas/collage.js +38 -0
  30. package/dist/cli/schemas/grid.d.ts +34 -0
  31. package/dist/cli/schemas/grid.js +38 -0
  32. package/dist/cli/schemas/masonry.d.ts +62 -0
  33. package/dist/cli/schemas/masonry.js +62 -0
  34. package/dist/cli/schemas/template.d.ts +31 -0
  35. package/dist/cli/schemas/template.js +49 -0
  36. package/dist/cli/utils/buildCommandFromSchema.d.ts +8 -0
  37. package/dist/cli/utils/buildCommandFromSchema.js +55 -0
  38. package/dist/cli/utils/configureCommandErrors.d.ts +2 -0
  39. package/dist/cli/utils/configureCommandErrors.js +22 -0
  40. package/dist/cli/utils/stringFormatter.d.ts +1 -0
  41. package/dist/cli/utils/stringFormatter.js +3 -0
  42. package/dist/cli/utils/toErrorMessage.d.ts +4 -0
  43. package/dist/cli/utils/toErrorMessage.js +22 -0
  44. package/dist/core/helpers.d.ts +10 -0
  45. package/dist/core/helpers.js +42 -0
  46. package/dist/core/index.d.ts +1 -0
  47. package/dist/core/index.js +1 -0
  48. package/dist/core/mergeError.d.ts +9 -0
  49. package/dist/core/mergeError.js +10 -0
  50. package/dist/core/merges/collage/index.d.ts +9 -0
  51. package/dist/core/merges/collage/index.js +32 -0
  52. package/dist/core/merges/collage/steps/calculateImageDimensions.d.ts +12 -0
  53. package/dist/core/merges/collage/steps/calculateImageDimensions.js +18 -0
  54. package/dist/core/merges/collage/steps/createComposites.d.ts +8 -0
  55. package/dist/core/merges/collage/steps/createComposites.js +58 -0
  56. package/dist/core/merges/collage/steps/resizeAndBorderImages.d.ts +12 -0
  57. package/dist/core/merges/collage/steps/resizeAndBorderImages.js +26 -0
  58. package/dist/core/merges/collage/steps/rotateImages.d.ts +7 -0
  59. package/dist/core/merges/collage/steps/rotateImages.js +9 -0
  60. package/dist/core/merges/grid/index.d.ts +12 -0
  61. package/dist/core/merges/grid/index.js +36 -0
  62. package/dist/core/merges/grid/steps/calculateCanvasDimensions.d.ts +8 -0
  63. package/dist/core/merges/grid/steps/calculateCanvasDimensions.js +18 -0
  64. package/dist/core/merges/grid/steps/calculateFontSize.d.ts +7 -0
  65. package/dist/core/merges/grid/steps/calculateFontSize.js +19 -0
  66. package/dist/core/merges/grid/steps/calculateImageDimensions.d.ts +8 -0
  67. package/dist/core/merges/grid/steps/calculateImageDimensions.js +18 -0
  68. package/dist/core/merges/grid/steps/createComposites.d.ts +10 -0
  69. package/dist/core/merges/grid/steps/createComposites.js +63 -0
  70. package/dist/core/merges/grid/steps/prepareImages.d.ts +10 -0
  71. package/dist/core/merges/grid/steps/prepareImages.js +29 -0
  72. package/dist/core/merges/grid/steps/shuffleImagesAndCaptions.d.ts +7 -0
  73. package/dist/core/merges/grid/steps/shuffleImagesAndCaptions.js +17 -0
  74. package/dist/core/merges/index.d.ts +3 -0
  75. package/dist/core/merges/index.js +3 -0
  76. package/dist/core/merges/masonry/index.d.ts +10 -0
  77. package/dist/core/merges/masonry/index.js +32 -0
  78. package/dist/core/merges/masonry/steps/calculateCanvasDimensions.d.ts +15 -0
  79. package/dist/core/merges/masonry/steps/calculateCanvasDimensions.js +17 -0
  80. package/dist/core/merges/masonry/steps/calculateLaneSize.d.ts +9 -0
  81. package/dist/core/merges/masonry/steps/calculateLaneSize.js +27 -0
  82. package/dist/core/merges/masonry/steps/createComposites.d.ts +25 -0
  83. package/dist/core/merges/masonry/steps/createComposites.js +108 -0
  84. package/dist/core/merges/masonry/steps/resizeImages.d.ts +7 -0
  85. package/dist/core/merges/masonry/steps/resizeImages.js +14 -0
  86. package/dist/core/merges/masonry/steps/splitIntoLanes.d.ts +17 -0
  87. package/dist/core/merges/masonry/steps/splitIntoLanes.js +78 -0
  88. package/dist/core/merges/shared-steps/applyComposites.d.ts +2 -0
  89. package/dist/core/merges/shared-steps/applyComposites.js +16 -0
  90. package/dist/core/merges/shared-steps/createCanvas.d.ts +11 -0
  91. package/dist/core/merges/shared-steps/createCanvas.js +17 -0
  92. package/dist/core/merges/shared-steps/exportCanvas.d.ts +7 -0
  93. package/dist/core/merges/shared-steps/exportCanvas.js +25 -0
  94. package/dist/core/merges/shared-steps/finalizeImagePipelines.d.ts +2 -0
  95. package/dist/core/merges/shared-steps/finalizeImagePipelines.js +9 -0
  96. package/dist/core/merges/shared-steps/loadImages.d.ts +2 -0
  97. package/dist/core/merges/shared-steps/loadImages.js +26 -0
  98. package/dist/core/merges/shared-steps/validateCaptions.d.ts +10 -0
  99. package/dist/core/merges/shared-steps/validateCaptions.js +17 -0
  100. package/dist/core/merges/template/index.d.ts +10 -0
  101. package/dist/core/merges/template/index.js +28 -0
  102. package/dist/core/merges/template/steps/calculateSlotDimensions.d.ts +9 -0
  103. package/dist/core/merges/template/steps/calculateSlotDimensions.js +12 -0
  104. package/dist/core/merges/template/steps/createComposites.d.ts +10 -0
  105. package/dist/core/merges/template/steps/createComposites.js +25 -0
  106. package/dist/core/merges/template/steps/getBlocks.d.ts +13 -0
  107. package/dist/core/merges/template/steps/getBlocks.js +28 -0
  108. package/dist/core/merges/template/types.d.ts +21 -0
  109. package/dist/core/merges/template/types.js +1 -0
  110. package/dist/core/merges/types.d.ts +102 -0
  111. package/dist/core/merges/types.js +1 -0
  112. package/dist/core/modules/messages.d.ts +32 -0
  113. package/dist/core/modules/messages.js +54 -0
  114. package/dist/core/pipeline/guards.d.ts +4 -0
  115. package/dist/core/pipeline/guards.js +23 -0
  116. package/dist/core/pipeline/mergePipeline.d.ts +60 -0
  117. package/dist/core/pipeline/mergePipeline.js +122 -0
  118. package/dist/core/schemas/collage.d.ts +26 -0
  119. package/dist/core/schemas/collage.js +17 -0
  120. package/dist/core/schemas/grid.d.ts +32 -0
  121. package/dist/core/schemas/grid.js +29 -0
  122. package/dist/core/schemas/masonry.d.ts +56 -0
  123. package/dist/core/schemas/masonry.js +43 -0
  124. package/dist/core/schemas/template.d.ts +34 -0
  125. package/dist/core/schemas/template.js +88 -0
  126. package/dist/core/utils/colors/hexToRgba.d.ts +2 -0
  127. package/dist/core/utils/colors/hexToRgba.js +25 -0
  128. package/dist/core/utils/colors/rgbaToHex.d.ts +2 -0
  129. package/dist/core/utils/colors/rgbaToHex.js +15 -0
  130. package/dist/core/utils/colors/types.d.ts +7 -0
  131. package/dist/core/utils/colors/types.js +1 -0
  132. package/dist/core/utils/fonts/getFontSize.d.ts +9 -0
  133. package/dist/core/utils/fonts/getFontSize.js +40 -0
  134. package/dist/core/utils/images/addImageBorder.d.ts +13 -0
  135. package/dist/core/utils/images/addImageBorder.js +33 -0
  136. package/dist/core/utils/images/getImageHeights.d.ts +2 -0
  137. package/dist/core/utils/images/getImageHeights.js +9 -0
  138. package/dist/core/utils/images/getImageWidths.d.ts +2 -0
  139. package/dist/core/utils/images/getImageWidths.js +9 -0
  140. package/dist/core/utils/images/getSmallestImageDimensions.d.ts +5 -0
  141. package/dist/core/utils/images/getSmallestImageDimensions.js +9 -0
  142. package/dist/core/utils/images/handleImageEdges.d.ts +13 -0
  143. package/dist/core/utils/images/handleImageEdges.js +39 -0
  144. package/dist/core/utils/images/isActualImage.d.ts +5 -0
  145. package/dist/core/utils/images/isActualImage.js +26 -0
  146. package/dist/core/utils/images/parseAspectRatio.d.ts +1 -0
  147. package/dist/core/utils/images/parseAspectRatio.js +22 -0
  148. package/dist/core/utils/images/roundImage.d.ts +9 -0
  149. package/dist/core/utils/images/roundImage.js +27 -0
  150. package/dist/core/utils/images/roundImages.d.ts +8 -0
  151. package/dist/core/utils/images/roundImages.js +19 -0
  152. package/dist/core/utils/images/scaleImage.d.ts +8 -0
  153. package/dist/core/utils/images/scaleImage.js +36 -0
  154. package/dist/core/utils/images/scaleImages.d.ts +8 -0
  155. package/dist/core/utils/images/scaleImages.js +38 -0
  156. package/dist/core/utils/math/median.d.ts +1 -0
  157. package/dist/core/utils/math/median.js +12 -0
  158. package/dist/core/utils/math/randint.d.ts +6 -0
  159. package/dist/core/utils/math/randint.js +11 -0
  160. package/dist/core/utils/math/trimmedMedian.d.ts +1 -0
  161. package/dist/core/utils/math/trimmedMedian.js +12 -0
  162. package/dist/core/utils/svg/createSvgTextBuffer.d.ts +9 -0
  163. package/dist/core/utils/svg/createSvgTextBuffer.js +21 -0
  164. package/dist/validators/aspectRatio.d.ts +2 -0
  165. package/dist/validators/aspectRatio.js +15 -0
  166. package/dist/validators/coercion.d.ts +2 -0
  167. package/dist/validators/coercion.js +12 -0
  168. package/dist/validators/format.d.ts +2 -0
  169. package/dist/validators/format.js +15 -0
  170. package/dist/validators/hexColor.d.ts +7 -0
  171. package/dist/validators/hexColor.js +27 -0
  172. package/dist/validators/index.d.ts +95 -0
  173. package/dist/validators/index.js +64 -0
  174. package/dist/validators/outputFile.d.ts +2 -0
  175. package/dist/validators/outputFile.js +7 -0
  176. package/dist/validators/path.d.ts +3 -0
  177. package/dist/validators/path.js +18 -0
  178. package/dist/validators/sharpImageInput.d.ts +3 -0
  179. package/dist/validators/sharpImageInput.js +6 -0
  180. package/dist/validators/template.d.ts +15 -0
  181. package/dist/validators/template.js +41 -0
  182. package/package.json +26 -9
  183. package/bin/pixeli.js +0 -26
  184. package/commands/merge/collage.js +0 -83
  185. package/commands/merge/grid.js +0 -71
  186. package/commands/merge/helpers/utils.js +0 -11
  187. package/commands/merge/helpers/validations.js +0 -269
  188. package/commands/merge/index.js +0 -12
  189. package/commands/merge/masonry.js +0 -72
  190. package/lib/helpers/loadImages.js +0 -94
  191. package/lib/helpers/progressBar.js +0 -20
  192. package/lib/helpers/templateValidator.js +0 -139
  193. package/lib/helpers/utils.js +0 -208
  194. package/lib/merges/collage-merge/index.js +0 -110
  195. package/lib/merges/collage-merge/presets/artGallery.js +0 -17
  196. package/lib/merges/collage-merge/presets/dashboardShot.js +0 -18
  197. package/lib/merges/collage-merge/presets/horizontalBookSpread.js +0 -15
  198. package/lib/merges/collage-merge/presets/instagramGrid.js +0 -18
  199. package/lib/merges/collage-merge/presets/verticalBookSpread.js +0 -15
  200. package/lib/merges/grid-merge/index.js +0 -152
  201. package/lib/merges/masonry-merge/horizontal.js +0 -157
  202. package/lib/merges/masonry-merge/index.js +0 -57
  203. package/lib/merges/masonry-merge/vertical.js +0 -152
  204. package/lib/merges/merge-utils.js +0 -176
package/README.md CHANGED
@@ -3,23 +3,60 @@
3
3
 
4
4
  <img src="./assets/logo.svg" width="150" align="right">
5
5
 
6
- **Pixeli** is a lightweight and flexible command-line tool for merging multiple images into clean, customizable grid layouts. It’s designed for speed and simplicity, making it ideal for generating collages, previews, gallery layouts, inspiration boards, and composite images without relying on heavy desktop software.
6
+ **Pixeli** is a typescript-first, lightweight, and flexible command-line tool and library for merging multiple images into clean, customizable grid layouts. It’s designed for speed and simplicity, making it ideal for generating collages, previews, gallery layouts, inspiration boards, and composite images without relying on heavy desktop software.
7
7
 
8
8
  Pixeli uses Sharp, a Node.js wrapper for the libvips library which is based on C. This makes it an extremely fast tool with support for PNG, JPG, GIF, SVG, AVIF, etc.
9
9
 
10
- The tool currently supports two main layout modes: ***Grid*** and ***Masonry*** (horizontal / vertical). Each of them provide a distinct visual style to match a project's needs, for example:
10
+ The tool currently supports four main layout modes: ***Grid***, ***Masonry*** (horizontal / vertical), ***Template***, and ***Collage***. Each of them provide a distinct visual style to match a project's needs, for example:
11
11
 
12
12
  | Grid (1:1 images) | Contact Sheet Grid |
13
13
  |---|---|
14
14
  | <img src="samples/grid.jpg" width="400"> | <img src="samples/grid-with-captions.jpg" width="400"> |
15
15
  | **Masonry (Horizontal)** | **Masonry (Vertical)** |
16
16
  | <img src="samples/masonry-horizontal.jpg" width="400"> | <img src="samples/masonry-vertical.jpg" width="400"> |
17
- | **Collag (Instagram Grid)** | **Collage (Vertical Book Spread)** |
17
+ | **Template (Instagram Grid)** | **Template (Vertical Book Spread)** |
18
18
  | <img src="samples/instagram-grid.jpg" width="400"> | <img src="samples/vertical-book-spread.jpg" width="400"> |
19
- | **Collage (Horizontal Book Spread)** | **Collage (Dashboard Shot)** |
19
+ | **Template (Horizontal Book Spread)** | **Template (Dashboard Shot)** |
20
20
  | <img src="samples/horizontal-book-spread.jpg" width="400"> | <img src="samples/dashboard-shot.jpg" width="400"> |
21
- | **Collage (Art Gallery)** |
22
- | <img src="samples/art-gallery.jpg" width="400"> |
21
+ | **Template (Art Gallery)** | **Collage** |
22
+ | <img src="samples/art-gallery.jpg" width="400"> | <img src="samples/collage.jpg" width="400"> |
23
+
24
+ # Table of Contents
25
+ 1. [Installation](#installation)
26
+ 2. [Quick CLI Examples](#quick-cli-examples)
27
+ * [Basic Grid](#basic-grid)
28
+ * [Grid with Rectangular Images](#grid-with-rectangular-images)
29
+ * [Grid with 8 Columns](#grid-with-8-columns)
30
+ * [Contact Sheet](#contact-sheet)
31
+ * [Masonry Layout](#masonry-layout)
32
+ * [Template Layout](#template-layout)
33
+ * [Collage Layout](#collage-layout)
34
+ 3. [Full CLI Documentation](#full-cli-documentation)
35
+ * [pixeli](#pixeli)
36
+ * [pixeli grid](#pixeli-grid)
37
+ * [pixeli masonry](#pixeli-masonry)
38
+ * [pixeli template](#pixeli-template)
39
+ * [pixeli collage](#pixeli-collage)
40
+ 4. [Full Library Documentation](#full-library-documentation)
41
+ * [gridMerge Function Options](#gridmerge-function-options)
42
+ * [masonryMerge Function Options](#masonrymerge-function-options)
43
+ * [templateMerge Function Options](#templatemerge-function-options)
44
+ * [collageMerge Function Options](#collagemerge-function-options)
45
+ 5. [Other](#other)
46
+ * [JSON Templates](#json-templates)
47
+ * [Canvas](#canvas)
48
+ * [Slots](#slots)
49
+ * [Slot Rules](#slot-rules)
50
+ * [Sample JSON Template](#sample-json-template)
51
+ * [All Supported Input Formats](#all-supported-input-formats)
52
+ * [All Supported Output Formats](#all-supported-output-formats)
53
+ * [Pixel Limits](#pixel-limits)
54
+ * [Colors and Transparency](#colors-and-transparency)
55
+ * [CLI](#cli)
56
+ * [Library](#library)
57
+ 6. [License](#license)
58
+
59
+
23
60
 
24
61
  ## Installation
25
62
  Pixeli can be installed using npm. Simply run the following command to install it globally on your machine:
@@ -27,20 +64,25 @@ Pixeli can be installed using npm. Simply run the following command to install i
27
64
  npm i -g pixeli
28
65
  ```
29
66
 
67
+ If you're interested in the library functions and not the CLI, you can add it to your project instead of a global install:
68
+ ```bash
69
+ npm i pixeli
70
+ ```
71
+
30
72
  You can also run pixeli directly with npx without installing it globally. This is convenient for quick experiments or one-off usage:
31
73
  ```bash
32
74
  npx pixeli merge <subcommand> [options] <files...>
33
75
  ```
34
76
 
35
- ## Quick Examples
77
+ ## Quick CLI Examples
36
78
  To run these examples, you can visit the [GitHub Repository](https://github.com/pakdad-mousavi/pixeli) and use the images in the [Samples](https://github.com/pakdad-mousavi/pixeli/blob/main/samples/) directory, if you don't already have your own set of images.
37
79
 
38
- All merge commands are under the `pixeli merge` command and can be used like so: `pixeli merge [merge-mode] [options]`
80
+ All merge commands are under `pixeli` and can be used like so: `pixeli [merge-mode] [options]`
39
81
 
40
82
  ### Basic Grid
41
83
  To create a basic grid with 1:1 images, you can use the grid merge command. You'll also need to provide the individual filepaths to use, or use the `-rd` (--recursive and --directory) flags to get all the images from the specified directory:
42
84
  ```bash
43
- pixeli merge grid -rd ./samples/images
85
+ pixeli grid -rd ./samples/images
44
86
  ```
45
87
 
46
88
  Without the `-r` flag, only the images in the directory will be scanned, and any sub-directories will be ignored.
@@ -48,30 +90,30 @@ Without the `-r` flag, only the images in the directory will be scanned, and any
48
90
  ### Grid with Rectangular Images
49
91
  To create a grid with images that all have the same aspect ratio, you can specify the aspect ratio to use for all images using the `--ar` flag:
50
92
  ```bash
51
- pixeli merge grid -rd ./samples/images --ar 16:9
93
+ pixeli grid -rd ./samples/images --ar 16:9
52
94
  ```
53
95
 
54
96
  ### Grid with 8 Columns
55
97
  You can also customize the number of columns that you'd like the final image to have using the `-c` flag, followed by the number of columns:
56
98
  ```bash
57
- pixeli merge grid -rd ./samples/images -c 8
99
+ pixeli grid -rd ./samples/images -c 8
58
100
  ```
59
101
 
60
102
  ### Contact Sheet
61
103
  Contact sheet style grids can also be made using pixeli. To include each file name under its respective image, the `--ca` flag can be used:
62
104
  ```bash
63
- pixeli merge grid -rd ./samples/images --ca
105
+ pixeli grid -rd ./samples/images --ca
64
106
  ```
65
107
 
66
108
  The caption color can also be specified using the `--cc` flag, followed by a hex color:
67
109
  ```bash
68
- pixeli merge grid -rd ./samples/images --ca --cc "#ff0000"
110
+ pixeli grid -rd ./samples/images --ca --cc "#ff0000"
69
111
  ```
70
112
 
71
113
  ### Masonry Layout
72
114
  To create a masonry style image, you can use the masonry merge command. The `-rd` flag is used to specify which directory to use, and the canvas width can be specified using the `--cvw` flag:
73
115
  ```bash
74
- pixeli merge masonry -rd ./samples/images --cvw 4000
116
+ pixeli masonry -rd ./samples/images --cvw 4000
75
117
  ```
76
118
 
77
119
  By default, the masonry merge command uses a horizontal flow, but a vertical one can be specified using the `-f` flag, followed by the `--cvh` to specify the canvas height:
@@ -79,31 +121,61 @@ By default, the masonry merge command uses a horizontal flow, but a vertical one
79
121
  pixeli merge masonry -rd ./samples/images -f vertical --cvh 4000
80
122
  ```
81
123
 
124
+ Note that the masonry command always requires either the `--cvw` or `--cvh` option, depending on the flow.
125
+
126
+ ### Template Layout
127
+ Template layouts require a JSON template which describe your specific layout. The `-t` flag is used to specify the path to a JSON template:
128
+ ```bash
129
+ pixeli template -rd ./samples/images -t ./template.json
130
+ ```
131
+
132
+ You could also use one of the presets provided using the `-p` flag:
133
+ ```bash
134
+ pixeli template -rd ./samples/images -p instagram-grid
135
+ ```
136
+
137
+ To learn about the JSON template, see [JSON Templates](#json-templates).
138
+
82
139
  ### Collage Layout
83
- Collage layouts require a JSON template, or an inline JSON string, which describe your specific layout. The `-t` flag is used to specify the path to a JSON template, whereas the `-m` flag is used to provide inline JSON:
140
+ Collage layouts are similar to grid layouts, in a way. Images are arranged in a grid, jittered, rotated, and overlapped to create a photo-wall style grid:
141
+ ```bash
142
+ pixeli collage -rd ./samples/images
143
+ ```
144
+
145
+ To customize the image sizes, use the `-w` flag:
146
+ ```bash
147
+ pixeli collage -rd ./samples/images -w 400
148
+ ```
149
+
150
+ To change the overlap percentage of any two images in the collage, use the `--op` flag:
84
151
  ```bash
85
- pixeli merge collage -rd ./samples/images -t ./template.json
152
+ pixeli collage -rd ./samples/images --op 10
86
153
  ```
87
154
 
88
- You could also use a preset, and also round all the image corners in your collage:
155
+ For varying image sizes, you can use the `--wv` flag to change the image width variance (in pixels):
89
156
  ```bash
90
- pixeli merge collage -rd ./samples/images -t ./template.json --cr 100
157
+ pixeli collage -rd ./samples/images --wv 50
91
158
  ```
92
159
 
93
- To learn about the JSON template, see [collage templates](#collage-templates).
160
+ To change the minimum and maximum degrees to rotate each image by, use the `--rr` flag to customize the rotation range:
161
+ ```bash
162
+ pixeli collage -rd ./samples/images --rr 15
163
+ ```
94
164
 
95
- ## Full Documentation
165
+ ## Full CLI Documentation
96
166
 
97
- ### pixeli merge
98
- Usage: `pixeli merge <subcommand> [options] <input...> -o <output>`
167
+ ### pixeli
168
+ Usage: `pixeli <subcommand> [options] <input...> -o <output>`
99
169
 
100
- The merge command is what allows you to create grids and mosaics with your images.
170
+ The `pixeli` command is what allows you to create grids and mosaics with your images.
101
171
  | Subcommand | Description | Options |
102
172
  | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
103
- | `grid` | Merge images into a uniform **rows × columns grid**, optionally with captions and per-image aspect ratios. | See [grid options table](#pixeli-merge-grid) |
104
- | `masonry` | Merge images into a **dynamic masonry layout**, preserving natural image proportions. Supports vertical or horizontal flow and alignment options. | See [masonry options table](#pixeli-merge-masonry) |
173
+ | `grid` | Merge images into a **uniform rows × columns grid**, optionally with captions and per-image aspect ratios. | See [grid options table](#pixeli-grid) |
174
+ | `masonry` | Merge images into a **dynamic masonry layout**, preserving natural image proportions. Supports vertical or horizontal flow and alignment options. | See [masonry options table](#pixeli-masonry) |
175
+ | `template` | Merge images into a **pre-defined layout**, based on the template provided, or the preset used. | See [template options table](#pixeli-template) |
176
+ | `collage` | Merge images into a **messy, photo-wall style grid**, great for posters or aesthetic layouts. | See [collage options table](#pixeli-collage) |
105
177
 
106
- The following options and flags are shared for all of the subcommands under the `pixeli merge` command:
178
+ The following options and flags are shared for all of the subcommands under the `pixeli` command:
107
179
  | Option | Default | Description |
108
180
  | ------------------------------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
109
181
  | `[files...]` | — | Image file paths to merge. You can specify multiple files or if you prefer directories, use `--dir`. |
@@ -113,13 +185,15 @@ The following options and flags are shared for all of the subcommands under the
113
185
  | `-g`, `--gap <px>` | `50` | **Spacing (in pixels) between images** in the layout. Applies to both horizontal and vertical gaps. |
114
186
  | `--cr`, `--corner-radius <px>` | `0` | How much to **round the corners** of each image in pixels. |
115
187
  | `--bg`, `--canvas-color <hex>` | `#ffffff` | Sets the **background color of the canvas**. Accepts HEX values (e.g., `#000000` for black). |
188
+ | `--bw`, `--border-width <px>` | `0` | Sets the **width of the border** in pixels. |
189
+ | `--bc`, `--border-color <hex>` | `#000` | Sets the **color of the border, if any**. Accepts HEX values (e.g., `#000000` for black). |
116
190
  | `-o`, `--output <file>` | `./pixeli.png` | Path for the **merged output image**. The format is inferred from the file extension (`.png`, `.jpg`, `.webp`, etc.). |
117
191
 
118
192
 
119
- ### pixeli merge grid
120
- Usage: `pixeli merge grid [options] [files...]`
193
+ ### pixeli grid
194
+ Usage: `pixeli grid [options] [files...]`
121
195
 
122
- The grid mode arranges images into a clean, uniform grid with fixed columns and automatic row calculation. The table below displays all of the options available to this command:
196
+ The grid merge arranges images into a clean, uniform grid with fixed columns and automatic row calculation. The table below displays all of the options available to this command:
123
197
  | Option/Flag | Default | Description |
124
198
  | ----------------------------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
125
199
  | `--ar`, `--aspect-ratio <width/height\|number>` | `1:1` | Sets the **per-image aspect ratio**. Accepts ratio expressions (`16/9`, `4:3`) or decimal values (`1.777`). Images are scaled as needed to match this ratio before placement. |
@@ -129,10 +203,10 @@ The grid mode arranges images into a clean, uniform grid with fixed columns and
129
203
  | `--cc`, `--caption-color <hex>` | `#000000` | HEX color value for caption text (e.g., `#ffffff`, `#ff9900`). Affects all captions uniformly. |
130
204
  | `--mcs`, `--max-caption-size <pt>` | `100` | Sets the **maximum allowed caption font size**. Useful when images are extremely large and the caption is not big enough. The renderer may auto-reduce the font size if necessary. |
131
205
 
132
- ### pixeli merge masonry
133
- Usage: `pixeli merge masonry [options] [files...]`
206
+ ### pixeli masonry
207
+ Usage: `pixeli masonry [options] [files...]`
134
208
 
135
- The masonry mode preserves each image’s natural shape, creating an organic brick-wall layout similar to Pinterest boards.
209
+ The masonry merge preserves each image’s natural shape, creating an organic brick-wall layout similar to Pinterest boards.
136
210
 
137
211
  | Option/Flag | Default | Description |
138
212
  | ---------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -144,70 +218,202 @@ The masonry mode preserves each image’s natural shape, creating an organic bri
144
218
  | `--ha`, `--h-align <left\|center\|right\|justified>` | `justified` | Controls **horizontal alignment** of rows when in `horizontal` flow. `justified` overfills each row and crops the final image to fill up the canvas. |
145
219
  | `--va`, `--v-align <top\|middle\|bottom\|justified>` | `justified` | Controls **vertical alignment** of columns when in `vertical` flow. `justified` overfills each column and crops the final image to fill up the canvas. |
146
220
 
147
- ### pixeli merge collage
148
- Usage: `pixeli merge collage [options] [files...]`
221
+ ### pixeli template
222
+ Usage: `pixeli template [options] [files...]`
223
+
224
+ The template merge requires a specified JSON template file, or JSON string. Images will be placed as per the template. If a preset ID is provided, both `--template` and `--mapping` are ignored.
225
+
226
+ | Option/Flag | Default | Description |
227
+ | ---------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
228
+ | `-t`, `--template <path>` | `null` | Sets the **path to the JSON template file** which will be used to arrange the collage. Either use `--template` or `--preset`. |
229
+ | `-p`, `--preset <preset-id>` | `null` | Use a **pre-defined collage preset** instead of providing your own. Available preset IDs: `instagram-grid`, `dashboardShot`, `horizontal-book-spread`, `vertical-book-spread`, `art-gallery` |
230
+
231
+ ### pixeli collage
232
+ Usage: `pixeli collage [options] [files...]`
233
+
234
+ The collage merge arranges images into a messy, photo-wall style grid with fixed columns and automatic row calculation. The table below displays all of the options available to this command:
235
+
236
+ | Option/Flag | Default | Description |
237
+ | ----------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
238
+ | `--ar`, `--aspect-ratio <width/height\|number>` | `1:1` | Sets the **per-image aspect ratio**. Accepts ratio expressions (`16/9`, `4:3`) or decimal values (`1.777`). Images are scaled as needed to match this ratio before placement. |
239
+ | `-w`, `--image-width <px>` | *trimmed median image width* | Sets the **final width of each processed image** in the grid. The height is derived automatically based on the chosen aspect ratio. |
240
+ | `-c`, `--columns <n>` | `4` | Defines how many **images per row** are placed in the grid. The total number of rows is calculated from the number of inputs. |
241
+ | `--op`, `--overlap-percentage <percent>` | `25` | Defines the **percentage of both vertical and horizontal overlap** between any two images. A higher percentage results in tighter, more packed collages. |
242
+ | `--rr`, `--rotation-range <deg>` | `7` | Defines the **minimum and maximum rotation**. A random rotation of this amount in degrees will be applied to each image. For no rotation, a value of `0` can be used. |
243
+ | `--wv`, `--image-width-variance <px>` | `10` | Defines the **random variation in image width** that is added to each image width (image height variance is automatically calculated). This helps create more natural collages. A larger image variance results in more uneven image sizes. |
244
+
245
+ ## Full Library Documentation
149
246
 
150
- The collage merge requires a specified JSON template file, or JSON string. Images will be placed as per the template. If a preset ID is provided, both `--template` and `--mapping` are ignored.
247
+ Pixeli also provides functions for every merge. They can be imported like so:
151
248
 
152
- | Option/Flag | Default | Description |
153
- | ---------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
154
- | `-t`, `--template <path>` | `null` | Sets the **path to the JSON template file** which will be used to arrange the collage. Priority is given to this option if `--mapping` is not provided. |
155
- | `-m`, `--mapping <string>` | `null` | Sets the **JSON string** which will be parsed to later arrange the collage. Priority is given to `--template` if both options are provided. |
156
- | `-p`, `--preset <preset-id>` | `null` | Use a **predefined collage preset** instead of providing your own. Available preset IDs: `instagram-grid`, `dashboardShot`, `horizontal-book-spread`, `vertical-book-spread`, `art-gallery` |
157
249
 
158
- ### Collage Templates
159
- The following javascript object thoroughly describes the shape of the JSON objects which are expected to be received. Logical checks are performed on the values after the template is validated. This is to ensure the collage can be created, for example, without any overlaps or 0 pixel-wide images:
160
250
  ```javascript
251
+ import { gridMerge, masonryMerge, templageMerge, collageMerge } from 'pixeli';
252
+ ```
253
+
254
+ All merge functions have the following signature:
255
+
256
+ ```typescript
257
+ interface MergeCommand<T> {
258
+ (
259
+ imageInputs: sharp.SharpInput[],
260
+ options: T,
261
+ onProgress?: (total: number, completed: number, phase: string): void;
262
+ ): Promise<Buffer>;
263
+ }
264
+ ```
265
+
266
+ The `imageInputs` parameter takes an array of valid image inputs which will be processed by sharp to create sharp instances. An image input can be a `Buffer` object, any subclass of `Buffer`, a file path string, or any other input type supported by the Sharp `SharpInput` interface.
267
+
268
+ The `options` parameter is where merge-specific options are given as an object. Each merge function has their own set of supported options.
269
+
270
+ The `onProgress` parameter is optional. It is a callback function which is called everytime progress is made during a merge operation. If provided, it will receive a `ProgressInfo` object, which contains the total number of images to be processed, the number of completed images so far, and the current phase of the merge (e.g., "Merging images" or "Initializing").
271
+
272
+ ⚠️ NOTE ⚠️: The `onProgress` callback will be changed in upcoming versions.
273
+
274
+ The returned value of the function, if successful, is a buffer containing the final mosaic. If not successful, a `MergeError` will be thrown. To learn more about error handling, see ***wopuhfewopifhvweproihvfewpoihv*** MergeErrors.
275
+
276
+ ### gridMerge Function Options
277
+
278
+ The `gridMerge` function has the following set of options:
279
+
280
+ | Option | Data Type | Description |
281
+ | ---------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
282
+ | `shuffle` | `boolean` | Whether to randomize the image order before merging. |
283
+ | `cornerRadius` | `number` | Rounded corner radius in pixels applied to each image. |
284
+ | `gap` | `number` | Gap between images in pixels. |
285
+ | `canvasColor` | `Color` | Background color of the output canvas. |
286
+ | `borderWidth` | `number` | Width of the border around each image in pixels. Borders are drawn internally within each image. |
287
+ | `borderColor` | `Color` | Color of the border around each image. |
288
+ | `format` | `string` | Output image format (e.g., `png`, `jpeg`, `webp`). |
289
+ | `aspectRatio` | `string \| number` | Aspect ratio of each image cell. Used to calculate image height based on the given width. Examples: `"16:9"`, `"3x2"`, or `1.777`. |
290
+ | `imageWidth` | `number \| undefined` | Width of each image cell in pixels. If undefined, the median width of the input images is used. |
291
+ | `columns` | `number` | Number of columns in the grid layout. |
292
+ | `caption` | `boolean` | Whether to render captions under images. |
293
+ | `captions` | `string[]` | Caption text for each image, in order. |
294
+ | `captionColor` | `Color` | Text color used for image captions. |
295
+ | `maxCaptionSize` | `number` | Maximum caption font size in pixels. |
296
+
297
+ ### masonryMerge Function Options
298
+
299
+ The `masonryMerge` function has the following set of options:
300
+
301
+ | Option | Data Type | Description |
302
+ | -------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
303
+ | `shuffle` | `boolean` | Whether to randomize the image order before merging. |
304
+ | `cornerRadius` | `number` | Rounded corner radius in pixels applied to each image. |
305
+ | `gap` | `number` | Gap between images in pixels. |
306
+ | `canvasColor` | `Color` | Background color of the output canvas. |
307
+ | `borderWidth` | `number` | Width of the border around each image in pixels. Borders are drawn internally within each image. |
308
+ | `borderColor` | `Color` | Color of the border around each image. |
309
+ | `format` | `string` | Output image format (e.g., `png`, `jpeg`, `webp`). |
310
+ | `rowHeight` | `number \| undefined` | Height of each row in pixels. Defaults to the trimmed median image height if undefined. Only applied in horizontal layouts. |
311
+ | `columnWidth` | `number \| undefined` | Width of each column in pixels. Defaults to the trimmed median image width if undefined. Only applied in vertical layouts. |
312
+ | `canvasWidth` | `number \| undefined` | Width of the entire output canvas in pixels. Required when using horizontal flow. |
313
+ | `canvasHeight` | `number \| undefined` | Height of the entire output canvas in pixels. Required when using vertical flow. |
314
+ | `flow` | `'horizontal' \| 'vertical'` | Orientation of the masonry layout. Determines whether items flow by rows (horizontal) or by columns (vertical). |
315
+ | `hAlign` | `'left' \| 'center' \| 'right' \| 'justified'` | Horizontal alignment of items within each row. Only applied in horizontal layouts. |
316
+ | `vAlign` | `'top' \| 'middle' \| 'bottom' \| 'justified'` | Vertical alignment of items within each column. Only applied in vertical layouts. |
317
+
318
+ ### templateMerge Function Options
319
+
320
+ The `templateMerge` function has the following set of options:
321
+
322
+ | Option | Data Type | Description |
323
+ | -------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
324
+ | `shuffle` | `boolean` | Whether to randomize the image order before merging. |
325
+ | `cornerRadius` | `number` | Rounded corner radius in pixels applied to each image. |
326
+ | `gap` | `number` | Gap between images in pixels. |
327
+ | `canvasColor` | `Color` | Background color of the output canvas. |
328
+ | `borderWidth` | `number` | Width of the border around each image in pixels. Borders are drawn internally within each image. |
329
+ | `borderColor` | `Color` | Color of the border around each image. |
330
+ | `format` | `string` | Output image format (e.g., `png`, `jpeg`, `webp`). |
331
+ | `template` | `Template` | An object definition describing the layout, slots, and canvas configuration used to place images. See [JSON Templates](#json-templates) for more information. |
332
+
333
+ ### collageMerge Function Options
334
+
335
+ The `collageMerge` function has the following set of options:
336
+
337
+ | Option | Data Type | Description |
338
+ | -------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
339
+ | `shuffle` | `boolean` | Whether to randomize the image order before merging. |
340
+ | `cornerRadius` | `number` | Rounded corner radius in pixels applied to each image. |
341
+ | `canvasColor` | `Color` | Background color of the output canvas. |
342
+ | `borderWidth` | `number` | Width of the border around each image in pixels. Borders are drawn internally within each image. |
343
+ | `borderColor` | `Color` | Color of the border around each image. |
344
+ | `format` | `string` | Output image format (e.g., `png`, `jpeg`, `webp`). |
345
+ | `imageWidth` | `number` | Width of each image cell in pixels. If undefined, the median input image width is used. |
346
+ | `aspectRatio` | `string \| number` | Aspect ratio used to calculate image height from width. Examples: `"16:9"`, `"3x2"`, or `1.777`. |
347
+ | `columns` | `number` | Number of columns in the collage grid. |
348
+ | `imageWidthVariance` | `number` | Maximum number of pixels that each image width may randomly vary from `imageWidth`, creating natural size variation. For example, `50` allows images to be up to ±50 pixels wider or narrower. |
349
+ | `overlapPercentage` | `number` | Estimated percentage of overlap between neighboring images. Higher values create a tighter, denser collage. |
350
+ | `rotationRange` | `number` | Maximum absolute rotation angle in degrees. A value of `10` produces a random rotation between `-10°` and `+10°`. |
351
+
352
+ ## Other
353
+
354
+ ### JSON Templates
355
+ JSON templates used with template merge accept a JSON object that defines a grid-based canvas layout and how content occupies it.
356
+
357
+ The layout consists of:
358
+
359
+ - A canvas definition (overall grid size)
360
+ - A list of slots describing how items are placed inside the grid
361
+
362
+ Logical checks are performed on the values after the template is validated. This is to ensure the mosaic can be created, for example, without any overlaps or 0 pixel-wide images.
363
+
364
+ #### canvas
365
+
366
+ The **canvas** object defines the size and structure of the grid:
367
+ ```json
161
368
  {
162
- type: 'object',
163
- required: ['canvas', 'slots'],
164
- properties: {
165
- canvas: {
166
- type: 'object',
167
- required: ['width', 'height', 'columns', 'rows'],
168
- properties: {
169
- width: { type: 'number', minimum: 1, multipleOf: 1 },
170
- height: { type: 'number', minimum: 1, multipleOf: 1 },
171
- columns: { type: 'number', minimum: 1, multipleOf: 1 },
172
- rows: { type: 'number', minimum: 1, multipleOf: 1 },
173
- gap: { type: 'number', minimum: 0, multipleOf: 1 },
174
- background: { type: 'string' },
175
- },
176
- },
177
-
178
- slots: {
179
- type: 'array',
180
- items: {
181
- type: 'object',
182
- required: ['col', 'row', 'colSpan', 'rowSpan'],
183
- properties: {
184
- col: { type: 'number', minimum: 1, multipleOf: 1 },
185
- row: { type: 'number', minimum: 1, multipleOf: 1 },
186
- colSpan: { type: 'number', minimum: 1, multipleOf: 1 },
187
- rowSpan: { type: 'number', minimum: 1, multipleOf: 1 },
188
- },
189
- },
190
- },
191
- },
369
+ "canvas": {
370
+ "width": 1200,
371
+ "height": 800,
372
+ "columns": 4,
373
+ "rows": 3
374
+ }
192
375
  }
193
376
  ```
194
377
 
195
- The `template.canvas` object defines key properties of the canvas, and the `template.slots` array lists all the slots in which images are to be placed.
378
+ | Field | Type | Description |
379
+ | --------- | ------ | ---------------------------------------------------- |
380
+ | `width` | number | Canvas width in pixels. Must be a positive integer. |
381
+ | `height` | number | Canvas height in pixels. Must be a positive integer. |
382
+ | `columns` | number | Number of grid columns. Must be a positive integer. |
383
+ | `rows` | number | Number of grid rows. Must be a positive integer. |
196
384
 
197
- A slot object takes 4 properties: `col`, `row`, `colSpan`, and `rowSpan`. `col` and `row` specify which column and row to place the image in, while `colSpan` and `rowSpan` define how many units the image should take up horizontally and vertically.
385
+ #### slots
198
386
 
199
- The width of a single unit is equal to canvas width divided by the number of columns, and the height of a single unit is equal to the canvas height divided by the number of rows.
387
+ The **slots** array contains a series of slots, where each slot defines where an item should appear in the grid and how many grid cells it occupies:
200
388
 
201
- For example:
202
389
  ```json
203
- {
204
- "col": 1,
205
- "row": 5,
206
- "colSpan": 3,
207
- "rowSpan": 2
390
+ {
391
+ "slots": [
392
+ { "col": 1, "row": 1, "colSpan": 2, "rowSpan": 1 },
393
+ { "col": 3, "row": 2, "colSpan": 1, "rowSpan": 2 }
394
+ ]
208
395
  }
209
396
  ```
210
- This slot will be placed at the 1st column from the left, at the 5th row from the top. It will span 3 columns, including the one it has been placed in, meaning it will take up column 1, 2, and 3. The same goes for the rows; the slot will take up row 5 and 6.
397
+
398
+ | Field | Type | Description |
399
+ | --------- | ------ | --------------------------------- |
400
+ | `col` | number | Starting column index (1-based). |
401
+ | `row` | number | Starting row index (1-based). |
402
+ | `colSpan` | number | Number of columns the slot spans. |
403
+ | `rowSpan` | number | Number of rows the slot spans. |
404
+
405
+ #### Slot Rules
406
+
407
+ - All values must be positive integers.
408
+ - Slots must fit within the grid:
409
+ ```
410
+ col + colSpan - 1 ≤ columns
411
+ row + rowSpan - 1 ≤ rows
412
+ ```
413
+ - Overlapping slots will be rejected.
414
+ - Slot indices start at 1, not 0.
415
+
416
+ #### Sample JSON Template
211
417
 
212
418
  This is an example of a full JSON template:
213
419
  ```json
@@ -217,8 +423,6 @@ This is an example of a full JSON template:
217
423
  "height": 1600,
218
424
  "columns": 3,
219
425
  "rows": 6,
220
- "gap": 12,
221
- "background": "#000"
222
426
  },
223
427
  "slots": [
224
428
  { "col": 1, "row": 1, "colSpan": 2, "rowSpan": 2 },
@@ -233,8 +437,57 @@ This is an example of a full JSON template:
233
437
 
234
438
  Note that the `canvas.background` and `canvas.gap` properties are optional. If they are not provided, the defaults from the CLI options will be used. If both the CLI and template options exists, the template options take priority.
235
439
 
236
- ## License
237
- This project is licensed under the [MIT License](./LICENSE).
440
+ ### All Supported Input Formats
238
441
 
239
- ## Other
240
- This project was submitted to [Hack Club](https://hackclub.com/), a group consisting of over 100,000 teen hackers from around the world who work on cool projects and get to participate in awesome programs like [Midnight](https://midnight.hackclub.com).
442
+ - ***webp***
443
+ - ***gif***
444
+ - ***jpeg***
445
+ - ***jpg***
446
+ - ***png***
447
+ - ***tiff***
448
+ - ***avif***
449
+ - ***svg***
450
+
451
+ ### All Supported Output Formats
452
+
453
+ - ***webp***
454
+ - ***gif***
455
+ - ***jpeg***
456
+ - ***jpg***
457
+ - ***png***
458
+ - ***tiff***
459
+ - ***avif***
460
+
461
+ ### Pixel Limits
462
+
463
+ Generating extremely large images significantly reduces speed, and may also lead to pixel limit errors. All image formats have a maximum width and height, and if the created image exceeds those resolution limits, you will receive an error:
464
+
465
+ | Format | Typical Extension(s) | Max Width × Height | Notes |
466
+ | ---------------------------- | -------------------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
467
+ | **JPEG / JPG** | `.jpg`, `.jpeg` | **65,535 × 65,535 px** | Standard limit from JFIF/JPEG. No alpha. |
468
+ | **PNG** | `.png` | **~2,147,483,647 × 2,147,483,647 px** | Theoretical spec limit; real-world memory limits apply. Supports transparency. |
469
+ | **WebP** | `.webp` | **16,383 × 16,383 px** | Format standard limit — smaller than PNG/JPEG. |
470
+ | **GIF** | `.gif` | **65,536 × 65,536 px** | - |
471
+ | **BMP** | `.bmp` | **32,767×32,767 or ~2,147,483,647×2,147,483,647 px** | Depends on version/fields. |
472
+ | **TIFF** | `.tif`, `.tiff` | **4,294,967,295 × 4,294,967,295 px** (theoretical) | Very large; may be limited by software or memory. |
473
+
474
+ ### Colors and Transparency
475
+
476
+ #### CLI
477
+ Hex colors are used in the CLI.
478
+
479
+ For fully transparent images, a value of `transparent` is allowed. Note that the transparency of the canvas itself is depends on the output format; `jpg`, for example, does not have an alpha channel.
480
+
481
+ Semi-transparency is also allowed, and can be achieved with hex colors of the format `#rrggbbaa`, where the last two hex values represent the transparency.
482
+
483
+ #### Library
484
+ Colors in the library functions are either objects or hex values. The `Color` type is used to describe colors:
485
+
486
+ ```typescript
487
+ type Color = { r: number; g: number; b: number; alpha: number } | string;
488
+ ```
489
+
490
+ Given that a color object has been used instead of a hex value, note that `color.r`, `color.g`, and `color.b` are all values ranging from 0 to 255, while `color.alpha` is a value ranging from 0 to 1.
491
+
492
+ ## License
493
+ This project is licensed under the [MIT License](./LICENSE).
@@ -0,0 +1,2 @@
1
+ declare const collageCommand: import("commander").Command;
2
+ export default collageCommand;