feat: add montage subcommand for multi-PNG grid stitching (Pillow)
This commit is contained in:
@@ -218,6 +218,13 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
p_ra.add_argument("--value-col", default="value", help="数值列名 (default: value)")
|
||||
p_ra.add_argument("--title", default="", help="图表标题")
|
||||
|
||||
# montage
|
||||
p_mt = sub.add_parser("montage", help="多 PNG 拼图")
|
||||
p_mt.add_argument("--inputs", nargs="+", required=True, help="输入 PNG 文件列表")
|
||||
p_mt.add_argument("--output", required=True, help="拼图输出路径")
|
||||
p_mt.add_argument("--cols", type=int, default=2, help="列数 (default: 2)")
|
||||
p_mt.add_argument("--title", default="", help="总标题")
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@@ -241,6 +248,16 @@ def cmd_render_algo(args):
|
||||
render_algo(ts, vals, labels, windows, args.algo, args.output, title=title)
|
||||
|
||||
|
||||
def cmd_montage(args):
|
||||
"""montage 子命令:多 PNG 拼图。"""
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
||||
|
||||
from ts_anomaly_td.visualize import montage_pngs
|
||||
|
||||
montage_pngs(args.inputs, args.output, cols=args.cols, title=args.title)
|
||||
logger.info("montage complete: %s", args.output)
|
||||
|
||||
|
||||
def main():
|
||||
parser = build_parser()
|
||||
args = parser.parse_args()
|
||||
@@ -253,6 +270,7 @@ def main():
|
||||
"visualize": cmd_visualize,
|
||||
"watch": cmd_watch,
|
||||
"render-algo": cmd_render_algo,
|
||||
"montage": cmd_montage,
|
||||
}
|
||||
|
||||
fn = dispatch.get(args.command)
|
||||
|
||||
Reference in New Issue
Block a user