Skip to content

Commit

Permalink
Print out alpha-handling FYI in --verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
hzeller committed Jan 27, 2024
1 parent 608cdda commit d617cf6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/timg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,10 @@ int main(int argc, char *argv[]) {
bg_color = "none";
}

// If 'none' is chosen for background color, then emitting the
// PNG with alpha channels gives us compositing on client side.
if (is_pixel_direct_p(present.pixelation) &&
(strcasecmp(bg_color.c_str(), "none") == 0)) {
// If 'none' is chosen for background color, that implies local alpha
// handling; an optimization to emit RGB instead of RGBA for hi-res
// terminals or sending whitespace for background cut-off in block-display.
if ((strcasecmp(bg_color.c_str(), "none") == 0)) {
display_opts.local_alpha_handling = false;
}

Expand Down Expand Up @@ -1120,6 +1120,14 @@ int main(int argc, char *argv[]) {
"RGB #%02x%02x%02x\n",
bg_pattern_color, checker_bg.r, checker_bg.g, checker_bg.b);
}
if (display_opts.local_alpha_handling) {
fprintf(stderr,
"Alpha-channel merging with "
"background color done by timg.\n");
}
else {
fprintf(stderr, "Alpha-channel handled by terminal.\n");
}
const Duration d = end_show - start_show;
const uint64_t written_bytes =
sequencer.bytes_total() - sequencer.bytes_skipped();
Expand Down

0 comments on commit d617cf6

Please sign in to comment.