In the Thumbnail section, selecting a thumbnail often causes the images to disappear and be replaced by debugger HTML and an error message.
Sometimes the thumbnails work fine, but this error comes up more often than not.
The format of the image I click on doesn't seem to make a difference.
As of yet I haven't been able to detect a pattern to the trigger.
The rest of the app still works; I can click through images using the left/right arrows in the metadata
section, but as I do thumbnails section will switch between showing thumbnails and error message.
OSError
OSError: cannot write mode RGBA as JPEG
Traceback (most recent call last)
File "/opt/homebrew/lib/python3.11/site-packages/PIL/JpegImagePlugin.py", line 643, in _save
rawmode = RAWMODE[im.mode]
^^^^^^^^^^^^^^^^
The above exception was the direct cause of the following exception:
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2551, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2531, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 349, in thumbnails
thumbnails = fetch_thumbnails(limit=limit, offset=offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 220, in fetch_thumbnails
thumbnail = (get_thumbnail_from_image(image))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 196, in get_thumbnail_from_image
img.save(thumbnail_path, format='JPEG', quality=85)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/PIL/Image.py", line 2431, in save
save_handler(self, fp, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/PIL/JpegImagePlugin.py", line 646, in _save
raise OSError(msg) from e
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: cannot write mode RGBA as JPEG
This is the Copy/Paste friendly version of the traceback.
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/PIL/JpegImagePlugin.py", line 643, in _save
rawmode = RAWMODE[im.mode]
^^^^^^^^^^^^^^^^
KeyError: 'RGBA'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2551, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2531, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 349, in thumbnails
thumbnails = fetch_thumbnails(limit=limit, offset=offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 220, in fetch_thumbnails
thumbnail = (get_thumbnail_from_image(image))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 196, in get_thumbnail_from_image
img.save(thumbnail_path, format='JPEG', quality=85)
File "/opt/homebrew/lib/python3.11/site-packages/PIL/Image.py", line 2431, in save
save_handler(self, fp, filename)
File "/opt/homebrew/lib/python3.11/site-packages/PIL/JpegImagePlugin.py", line 646, in _save
raise OSError(msg) from e
OSError: cannot write mode RGBA as JPEG
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. If you enable JavaScript you can also use additional features such as code execution (if the evalex feature is enabled), automatic pasting of the exceptions and much more.
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /imagedirection?direction=next&image_name=%2FUsers%2Fuser%2F-AI%2FREFERENCE%2FGRABS%2FUnstable%20Diffusion%2Fland-and-cityscapes%2F00084-2838196845.png HTTP/1.1" 302 -
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /img?image_name=%2FUsers%2Fuser%2F-AI%2FREFERENCE%2FGRABS%2FUnstable+Diffusion%2Fland-and-cityscapes%2F00005-2485980304.png HTTP/1.1" 200 -
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /static/css/default.css HTTP/1.1" 304 -
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /image?image_name=%2FUsers%2Fuser%2F-AI%2FREFERENCE%2FGRABS%2FUnstable+Diffusion%2Fland-and-cityscapes%2F00005-2485980304.png HTTP/1.1" 200 -
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /static/js/app.js HTTP/1.1" 304 -
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /numimages HTTP/1.1" 200 -
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /thumbnails?limit=112&offset=0&imgsrc=/Users/user/Downloads/-AI/REFERENCE/GRABS/Unstable%20Diffusion/land-and-cityscapes/00005-2485980304.png HTTP/1.1" 500 -
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/PIL/JpegImagePlugin.py", line 643, in _save
rawmode = RAWMODE[im.mode]
^^^^^^^^^^^^^^^^
KeyError: 'RGBA'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2551, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2531, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 349, in thumbnails
thumbnails = fetch_thumbnails(limit=limit, offset=offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 220, in fetch_thumbnails
thumbnail = (get_thumbnail_from_image(image))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Promptvision/gallery.py", line 196, in get_thumbnail_from_image
img.save(thumbnail_path, format='JPEG', quality=85)
File "/opt/homebrew/lib/python3.11/site-packages/PIL/Image.py", line 2431, in save
save_handler(self, fp, filename)
File "/opt/homebrew/lib/python3.11/site-packages/PIL/JpegImagePlugin.py", line 646, in _save
raise OSError(msg) from e
OSError: cannot write mode RGBA as JPEG
127.0.0.1 - - [26/Mar/2023 16:06:45] "GET /img?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 304 -