2023-03-03 06:02:00 +00:00
|
|
|
"""
|
2023-03-02 18:28:17 +00:00
|
|
|
Initialization file for invokeai.backend.image_util methods.
|
2023-03-03 06:02:00 +00:00
|
|
|
"""
|
2024-02-29 23:04:59 +00:00
|
|
|
|
2023-08-17 22:45:25 +00:00
|
|
|
from .patchmatch import PatchMatch # noqa: F401
|
|
|
|
from .pngwriter import PngWriter, PromptFormatter, retrieve_metadata, write_metadata # noqa: F401
|
|
|
|
from .seamless import configure_model_padding # noqa: F401
|
|
|
|
from .txt2mask import Txt2Mask # noqa: F401
|
|
|
|
from .util import InitImageResizer, make_grid # noqa: F401
|
2023-03-03 06:02:00 +00:00
|
|
|
|
2023-03-02 18:28:17 +00:00
|
|
|
|
|
|
|
def debug_image(debug_image, debug_text, debug_show=True, debug_result=False, debug_status=False):
|
2023-08-17 22:45:25 +00:00
|
|
|
from PIL import ImageDraw
|
|
|
|
|
2023-03-02 18:28:17 +00:00
|
|
|
if not debug_status:
|
|
|
|
return
|
|
|
|
|
|
|
|
image_copy = debug_image.copy().convert("RGBA")
|
|
|
|
ImageDraw.Draw(image_copy).text((5, 5), debug_text, (255, 0, 0))
|
|
|
|
|
|
|
|
if debug_show:
|
|
|
|
image_copy.show()
|
|
|
|
|
|
|
|
if debug_result:
|
|
|
|
return image_copy
|