MCPcopy
hub / github.com/leslievan/semi-utils / process

Method process

processor/filters.py:371–388  ·  view source on GitHub ↗
(self, ctx: PipelineContext)

Source from the content-addressed store, hash-verified

369
370class WatermarkWithTimestampFilter(FilterProcessor):
371 def process(self, ctx: PipelineContext):
372 img = ctx.get_buffer()[0]
373
374 if "height" not in ctx:
375 ctx.set("height", int(img.height * .02))
376 # 使用注册表动态获取处理器,避免直接导入
377 multi_text_processor = get_processor("multi_rich_text")
378 if multi_text_processor:
379 multi_text_processor().process(ctx)
380 else:
381 raise RuntimeError("multi_rich_text processor not found")
382 text = ctx.get_buffer()[0]
383
384 text_x = int(img.width * .93) - text.width
385 text_y = int(img.height * .95)
386
387 img.paste(text, (text_x, text_y), mask=text)
388 ctx.update_buffer([img]).save_buffer(self.name()).success()
389
390 def name(self) -> str:
391 return "watermark_with_timestamp"

Callers

nothing calls this directly

Calls 8

nameMethod · 0.95
get_processorFunction · 0.90
get_bufferMethod · 0.80
setMethod · 0.80
successMethod · 0.80
save_bufferMethod · 0.80
update_bufferMethod · 0.80
processMethod · 0.45

Tested by

no test coverage detected