pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
https://pymupdf.readthedocs.io
GNU Affero General Public License v3.0
4.54k stars 447 forks source link

pix = page.get_pixmap(matrix=matrix, clip=rect) recommend to modify function get_pixmap #3468

Closed Smonkey123 closed 1 month ago

Smonkey123 commented 1 month ago

Is your feature request related to a problem? Please describe. When I used pix = page.get_pixmap(matrix=matrix, clip=rect), I found: This function always performs the image cutting (clip) first, and then performs the matrix transformation, which may be in reverse order, should you perform the image transformation before performing the cutting?

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered Are there several options for how your request could be met?

Additional context Add any other context or screenshots about the feature request here.

JorjMcKie commented 1 month ago

The design has been chosen with due consideration: in this way only necessary data will submitted to any desired transformations, reducing memory requirements.

You can always create sub-pixmaps from a pixmap, so you can first transform and then extract a subset from the result.