Skip to content

Commit 43b13b9

Browse files
committed
add --increase-ref-index option
1 parent 002df6b commit 43b13b9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ arguments:
311311
Optionally, you can specify an integer identifier N (default = 1) after a comma to set the index of reference image.
312312
Reference indices are only supported by some fine-tunes of Flux Kontext with proper multi-reference support.
313313
Reference images with the same index will be stitched together and seen as one image.
314+
--increase-ref-index Automatically increase the indices of references images based on the order they are listed (starting with 1). Will overwrite any manually set indices
314315
-o, --output OUTPUT path to write result image to (default: ./output.png)
315316
-p, --prompt [PROMPT] the prompt to render
316317
-n, --negative-prompt PROMPT the negative prompt (default: "")

examples/cli/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct SDParams {
6565
std::string control_image_path;
6666
std::vector<std::string> ref_image_paths;
6767
std::vector<int> ref_image_indices;
68+
bool increase_ref_index = false;
6869

6970
std::string prompt;
7071
std::string negative_prompt;
@@ -208,6 +209,7 @@ void print_usage(int argc, const char* argv[]) {
208209
" Optionally, you can specify an integer identifier N (default = 1) after a comma to set the index of reference image.\n"
209210
" Reference indices are only supported by some fine-tunes of Flux Kontext with proper multi-reference support.\n"
210211
" Reference images with the same index will be stitched together and seen as one image.\n");
212+
printf(" --increase-ref-index Automatically increase the indices of references images based on the order they are listed (starting with 1). Will overwrite any manually set indices\n");
211213
printf(" -o, --output OUTPUT path to write result image to (default: ./output.png)\n");
212214
printf(" -p, --prompt [PROMPT] the prompt to render\n");
213215
printf(" -n, --negative-prompt PROMPT the negative prompt (default: \"\")\n");
@@ -444,6 +446,7 @@ void parse_args(int argc, const char** argv, SDParams& params) {
444446
{"", "--color", "", true, &params.color},
445447
{"", "--chroma-disable-dit-mask", "", false, &params.chroma_use_dit_mask},
446448
{"", "--chroma-enable-t5-mask", "", true, &params.chroma_use_t5_mask},
449+
{"", "--increase-ref-index", "", false, &params.increase_ref_index},
447450
};
448451

449452
auto on_mode_arg = [&](int argc, const char** argv, int index) {
@@ -612,6 +615,12 @@ void parse_args(int argc, const char** argv, SDParams& params) {
612615
exit(1);
613616
}
614617

618+
if(params.increase_ref_index){
619+
for(int i=0;i<params.ref_image_indices.size();i++){
620+
params.ref_image_indices[i]=i+1;
621+
}
622+
}
623+
615624
if (params.n_threads <= 0) {
616625
params.n_threads = get_num_physical_cores();
617626
}

0 commit comments

Comments
 (0)