Files
Copies/docs/crop_exercise_bottoms.md
T
2026-09-10 07:23:39 +02:00

1.9 KiB

Bottom cropping after exercise splitting

This review utility processes the exercise PDFs stored directly under Copies/CopieXX/. It never changes the source files. Modified PDFs are written to a matching tree under the chosen output directory; unchanged PDFs are not copied.

python -m copienator.crop_exercise_bottoms Interro01 tmp/exercise-bottom-crop

One line is 1/36 of the uncropped full-page height recorded by the matching Copies/CopieXX.pdf. Each exercise PDF page is considered independently:

  1. Pages shorter than 10 lines are skipped.
  2. The bottom 0.75 line is excluded from detection so a fragment of the next label cannot keep a large blank area.
  3. The existing scan detector locates the last ink above that strip and keeps 6 mm of padding.
  4. The bottom CropBox changes only if the proposed removal is at least 4 lines. The top CropBox is always retained.

The ignored 0.75-line strip is therefore not removed on its own. It is included in the result only when the complete proposed crop passes the four-line threshold.

The output contains index.html, previews with removed areas shaded red, a plain cropped-files.txt list, report.json, and report.csv. The command uses five worker processes by default; --workers, --dpi, and --padding-mm are configurable.

GUI integration

After Découper les réponses par question, the GUI offers the facultative step Rogner le bas des réponses. It runs the same thresholds at 200 dpi and uses five worker processes by default. Only PDFs with an accepted crop are replaced. Their unmodified versions and the complete report are stored under .copienator/runs/crop-exercise-bottoms-*/; a failure or interruption before publication leaves every exercise PDF unchanged. The Archivage step removes these retained originals and reports. When ALWAYS_CROP is true in config.py, this facultative step starts automatically when first reached; the default configuration keeps it manual.