Hide 'No Image data blocks found.' message
This commit is contained in:
parent
adadb4e3c7
commit
d212fb59fe
|
@ -1,12 +1,15 @@
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import warnings
|
import warnings
|
||||||
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import zlib
|
import zlib
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EmbeddingEncoder(json.JSONEncoder):
|
class EmbeddingEncoder(json.JSONEncoder):
|
||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
|
@ -114,7 +117,7 @@ def extract_image_data_embed(image):
|
||||||
outarr = crop_black(np.array(image.convert('RGB').getdata()).reshape(image.size[1], image.size[0], d).astype(np.uint8)) & 0x0F
|
outarr = crop_black(np.array(image.convert('RGB').getdata()).reshape(image.size[1], image.size[0], d).astype(np.uint8)) & 0x0F
|
||||||
black_cols = np.where(np.sum(outarr, axis=(0, 2)) == 0)
|
black_cols = np.where(np.sum(outarr, axis=(0, 2)) == 0)
|
||||||
if black_cols[0].shape[0] < 2:
|
if black_cols[0].shape[0] < 2:
|
||||||
print('No Image data blocks found.')
|
logger.debug('No Image data blocks found.')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
data_block_lower = outarr[:, :black_cols[0].min(), :].astype(np.uint8)
|
data_block_lower = outarr[:, :black_cols[0].min(), :].astype(np.uint8)
|
||||||
|
|
Loading…
Reference in New Issue