Skip to content

Commit 8d85e74

Browse files
committed
Update faq.rst
1 parent 2922915 commit 8d85e74

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/faq.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,10 @@ To recover the original image using PyMuPDF, the procedure depicted as follows m
164164
.. image:: images/img-stencil.jpg
165165
:scale: 60
166166

167-
::
168-
pix1 = fitz.Pixmap(doc, xref) # (1) pixmap of image w/o alpha
169-
pix2 = fitz.Pixmap(doc, smask) # (2) stencil pixmap
170-
pix = fitz.Pixmap(pix1) # (3) copy of pix1, empty alpha channel added
171-
pix.setAlpha(pix2.samples) # (4) fill alpha channel
167+
>>> pix1 = fitz.Pixmap(doc, xref) # (1) pixmap of image w/o alpha
168+
>>> pix2 = fitz.Pixmap(doc, smask) # (2) stencil pixmap
169+
>>> pix = fitz.Pixmap(pix1) # (3) copy of pix1, empty alpha channel added
170+
>>> pix.setAlpha(pix2.samples) # (4) fill alpha channel
172171

173172
Step (1) creates a pixmap of the "netto" image. Step (2) does the same with the stencil mask. Please note that the :attr:`Pixmap.samples` attribute of *pix2* contains the alpha bytes that must be stored in the final pixmap. This is what happens in step (3) and (4).
174173

0 commit comments

Comments
 (0)