Render a page region to PNG bytes at the given DPI.
(page, bbox: tuple[float, float, float, float], dpi: int)
| 1044 | |
| 1045 | |
| 1046 | def _render_crop(page, bbox: tuple[float, float, float, float], dpi: int) -> bytes: |
| 1047 | """Render a page region to PNG bytes at the given DPI.""" |
| 1048 | clip = fitz.Rect(*bbox) |
| 1049 | scale = dpi / 72.0 |
| 1050 | matrix = fitz.Matrix(scale, scale) |
| 1051 | pix = page.get_pixmap(matrix=matrix, clip=clip, alpha=False) |
| 1052 | return pix.tobytes("png") |
| 1053 | |
| 1054 | |
| 1055 | def _unique_figure_asset_filename(page_number: int, label: str, used_filenames: set[str]) -> str: |
no outgoing calls
no test coverage detected