1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

Fine tune color detection (#1126)

* initial commit

* refactor

* pdf colorspace note

* refactor

* webtoons are always color
This commit is contained in:
Alex Xu
2025-10-20 17:09:01 -07:00
committed by GitHub
parent 06194b33ad
commit a7428f18b6
2 changed files with 50 additions and 13 deletions

View File

@@ -742,6 +742,7 @@ def render_page(vector):
zoom = target_height / page.rect.height
mat = pymupdf.Matrix(zoom, zoom)
# TODO: decide colorspace earlier so later color check is cheaper.
# This is actually pretty hard when you have to deal with color vector text
pix = page.get_pixmap(matrix=mat, colorspace='RGB', alpha=False)
pix.save(os.path.join(output_dir, "p-%i.png" % i))
print("Processed page numbers %i through %i" % (seg_from, seg_to - 1))