diffusionbee-stable-diffusion-ui icon indicating copy to clipboard operation
diffusionbee-stable-diffusion-ui copied to clipboard

0.3.0 "delete" in history view does not delete the image

Open mpdehaan opened this issue 2 years ago • 2 comments

Thanks for making a really nice distribution for this, very well done! Looking forward to seeing what happens in future updates.

I noticed in 0.3.0 image history is saved in "~/.diffusionbee/images" in the home directory, but many users may not know this. As they use SD over time, this directory will keep growing and getting larger.

I would suggest that pressing "delete" on an image in the "history" tab also deletes the corresponding images in this folder. Alternatively, you may also want to prefix the images with a directory named after the date they are created or something, so it's easier to find/delete old content.

mpdehaan avatar Sep 25 '22 20:09 mpdehaan

I'm using version 1.5.1 and this is still an issue. It won't be obvious at all to most users that pressing "delete" won't actually delete the saved images.

mattbisme avatar Dec 08 '22 09:12 mattbisme

here is a quick and dirty python3 script I use to move to the trash files in ~./diffusionbee/images/ that are no longer in history


#!/usr/bin/env python3

import os
import json
import send2trash

bee_path = os.path.expanduser("~/.diffusionbee")
json_path = os.path.join(bee_path, "data.json")

with open(json_path) as f:
    data = json.load(f)

imgs_array = []

for key in data['history']:
    imgs_array += data['history'][key]['imgs']

imgs_path = os.path.join(bee_path, "images")

for root, dirs, files in os.walk(imgs_path):
    for file in files:
        img_path = os.path.join(root, file)
        if img_path not in imgs_array:
            print("pruning %s " % img_path)
            send2trash.send2trash(img_path)

The script uses send2trash, which you may need to install with

pip3 install send2trash

thataboy avatar May 13 '23 02:05 thataboy