Skip to content

Commit ff2cabc

Browse files
committed
fixed kontext and photomaker (+1 squashed commits)
Squashed commits: [de0ac91] photomaker use 1 channel
1 parent 5a6cc38 commit ff2cabc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

otherarch/sdcpp/sdtype_adapter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,11 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
566566
input_extraimage_buffer = nullptr;
567567
}
568568
int nx2, ny2, nc2;
569+
int desiredchannels = 3;
569570
extraimage_buffer = kcpp_base64_decode(extra_image_data);
570-
input_extraimage_buffer = stbi_load_from_memory(extraimage_buffer.data(), extraimage_buffer.size(), &nx2, &ny2, &nc2, 3);
571+
input_extraimage_buffer = stbi_load_from_memory(extraimage_buffer.data(), extraimage_buffer.size(), &nx2, &ny2, &nc2, desiredchannels);
571572
// Resize the image
572-
int resok = stbir_resize_uint8(input_extraimage_buffer, nx2, ny2, 0, resized_extraimage_buf.data(), img2imgW, img2imgH, 0, 1);
573+
int resok = stbir_resize_uint8(input_extraimage_buffer, nx2, ny2, 0, resized_extraimage_buf.data(), img2imgW, img2imgH, 0, desiredchannels);
573574
if (!resok) {
574575
printf("\nKCPP SD: resize extra image failed!\n");
575576
output.data = "";
@@ -578,7 +579,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
578579
}
579580
extraimage_reference.width = img2imgW;
580581
extraimage_reference.height = img2imgH;
581-
extraimage_reference.channel = img2imgC;
582+
extraimage_reference.channel = desiredchannels;
582583
extraimage_reference.data = resized_extraimage_buf.data();
583584

584585
//ensure prompt has img keyword, otherwise append it

0 commit comments

Comments
 (0)