MCPcopy Create free account
hub / github.com/NatsUIJM/autoContents / resize_and_encode_image

Function resize_and_encode_image

mainprogress/determine_toc_levels.py:110–121  ·  view source on GitHub ↗
(image_path: Path)

Source from the content-addressed store, hash-verified

108 """
109 验证并修复 CSV 内容(目标为 3 列:title, page_number, level)。
110 1. 若列数少于 3,尝试从右向左将全角逗号替换为半角逗号(最多替换两次)。
111 2. 若解析为 4 列以上,说明标题中包含了半角逗号,将前 n-2 列合并为 title。
112 """
113 lines = content.splitlines()
114 fixed_lines = []
115
116 for line in lines:
117 if not line.strip():
118 continue
119
120 # 尝试解析当前行
121 try:
122 reader = csv.reader(StringIO(line))
123 row = next(reader)
124 except Exception:

Callers 1

get_encoded_imageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected