We list a few examples of the Image Generator
's command here to illustrate its usefulness and ease of use.
Use the merge
command to merge several images from different directories into one.
Usage:
generator merge [flags]
Flags:
-d, --directory strings specify a directory
-h, --help help for merge
-o, --out string export the images
-D, --root string specify the root directory
let me try to explain how this tool work, please refer to the following diagram:
You can download our Example File for testing, there are five directories in the zip file, try to run the merge command below:
generator merge -D {YOUR_ROOT_DIRECTORY} -d background -d ears -d body -d eyes -d mouth -o {YOUR_OUTPUT_DIRECTORY}
As you can see, the merge command recognizes these options:
Please note that if the field has been set, the field
-d
will adding the input as a prefix. for example:generator -D `/root` -d `folder`
It will look for the images starting from
/root/folder
Name | Field | Type | Optional | Description |
---|---|---|---|---|
Root Direcoty | -D, --root | strings | true | specify the root directory, it is optional. |
Direcoty | -d, --directory | string | false | specify the directory, you can reuse it. |
Output | -o, --out | string | false | specify a directory for outputting result.json and images. |
Help | -h, --help | true | To see the usage document. |
Then you will get the analysis of the combinations like this:
The analytical result:
background -> 3
ears -> 3
body -> 3
eyes -> 3
mouth -> 3
Number of combinations: 243
Do you want to continue? (Y/N):
The merging program will run if you want to continue, and showing the errors:
Showing all errors below:
=== adding errors ===
=== merging errors ===
it's done, sucess count: 243
After the process of merging is done, you will get a json file for the result. As in the example below:
[
{
"id": 241,
"attributes": [
{
"trait_type": "background",
"value": "bg-yellow"
},
{
"trait_type": "ears",
"value": "ear-tiger"
},
{
"trait_type": "body",
"value": "body-tiger"
},
{
"trait_type": "eyes",
"value": "eye-sleepy"
},
{
"trait_type": "mouth",
"value": "mouth-rat-19"
}
],
"path": "/usr/local/241.png"
}
...
]