Add to-do
This commit is contained in:
parent
3cea4dad2d
commit
092069221a
@ -193,7 +193,7 @@ def has_alpha_channel(doc: Doc, xref: int):
|
|||||||
maybe_image = load_image_handle_from_xref(doc, xref)
|
maybe_image = load_image_handle_from_xref(doc, xref)
|
||||||
maybe_smask = maybe_image["smask"] if maybe_image else None
|
maybe_smask = maybe_image["smask"] if maybe_image else None
|
||||||
|
|
||||||
if maybe_smask: # Use monad
|
if maybe_smask: # TODO: Use monad.
|
||||||
return any([doc.extract_image(maybe_smask) is not None, bool(fitz.Pixmap(doc, maybe_smask).alpha)])
|
return any([doc.extract_image(maybe_smask) is not None, bool(fitz.Pixmap(doc, maybe_smask).alpha)])
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -261,7 +261,7 @@ def normalize_channels(array: np.ndarray):
|
|||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=None)
|
@lru_cache(maxsize=None)
|
||||||
def load_image_handle_from_xref(doc: Doc, xref: int) -> Union[dict, None]: # TODO: use Monad
|
def load_image_handle_from_xref(doc: Doc, xref: int) -> Union[dict, None]: # TODO: Use monad.
|
||||||
return doc.extract_image(xref)
|
return doc.extract_image(xref)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user