Skip to content

[Feature Request]: No Image data blocks found #15546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ema7569 opened this issue Apr 17, 2024 · 2 comments
Closed

[Feature Request]: No Image data blocks found #15546

ema7569 opened this issue Apr 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@ema7569
Copy link

ema7569 commented Apr 17, 2024

What would your feature do ?

On launch the web verify things and say this cryptic message: No Image data blocks found
I think it's because one extension has a missing image.preview or another thing, but it is possible to be more precise on this error message? Like also giving the extension name, the file path or any other info why this message show?
Thank

@ema7569 ema7569 added the enhancement New feature or request label Apr 17, 2024
@missionfloyd
Copy link
Collaborator

missionfloyd commented Apr 19, 2024

Textual inversion embeddings can be embedded in a PNG file, like this.

It checks each PNG file in the embeddings folder and displays this message if it's just a normal image.

data = extract_image_data_embed(embed_image)
if data:
name = data.get('name', name)
else:
# if data is None, means this is not an embedding, just a preview image
return

def extract_image_data_embed(image):
d = 3
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.')
return None

Images ending in .preview (e.g., embedding.preview.png) are ignored, as are other formats, such as JPEG.

if ext in ['.PNG', '.WEBP', '.JXL', '.AVIF']:
_, second_ext = os.path.splitext(name)
if second_ext.upper() == '.PREVIEW':
return

TLDR: It's harmless; you can ignore it.

@ema7569
Copy link
Author

ema7569 commented Apr 24, 2024

Thank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants