Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#15567 from AUTOMATIC1111/no-image-da…
Browse files Browse the repository at this point in the history
…ta-blocks-debug

Hide 'No Image data blocks found.' message
  • Loading branch information
AUTOMATIC1111 authored Apr 21, 2024
2 parents c8ac42a + d212fb5 commit 367b823
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/textual_inversion/image_embedding.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import base64
import json
import warnings
import logging

import numpy as np
import zlib
from PIL import Image, ImageDraw
import torch

logger = logging.getLogger(__name__)


class EmbeddingEncoder(json.JSONEncoder):
def default(self, obj):
Expand Down Expand Up @@ -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
black_cols = np.where(np.sum(outarr, axis=(0, 2)) == 0)
if black_cols[0].shape[0] < 2:
print('No Image data blocks found.')
logger.debug('No Image data blocks found.')
return None

data_block_lower = outarr[:, :black_cols[0].min(), :].astype(np.uint8)
Expand Down

0 comments on commit 367b823

Please sign in to comment.