Skip to content
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

very nice Graphical user interface #291

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Erickesau
Copy link

@Erickesau Erickesau commented Oct 14, 2022

Module_gfpgan.py now can be imported as library support all parámeters,
which is used by the GUI,
Support multi language.
NEW
Added full log feature
Fixed, background was not showing correct in some cumputers

Files used by graphical user interface. Icon  background, English and spanish language JSON
Graphical user interface with nice design Made with tkinter,
Support load and save settings 
English and spanish language , More languages can be added easy.

Module_gfpgan.py can be imported as library support parámeters
Is usted by the GUI.
Added full log feature
Fixed, background was not showing correc in some cumputes
@gamitarun048
Copy link

Uploading Screenshot_2022-10-15-20-39-38-25.jpg…

@joe-eis
Copy link

joe-eis commented Jan 28, 2023

Hola Erick, muchas gracias por tu esfuerzo, pero

unfortunately, I did not get this version, module_gfpgan.py - Erickesau/GFPGAN, to work either. The faces are well edited and pinned to a black background as if cut off.

No cooperation with RealESRGAN? Unfortunately I have no deep knowledge of programming ...

What else is needed to be able to start the GUI? I have post-installed tk and tcl with pip, but I still get the error:

    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "assets/icon.ico" not defined

@Erickesau
Copy link
Author

I used Windows 10 with Python 3.6 and work fine , maybe your tkinter versión not recognize the icon bitmap, delete líne 66 in Photo Restorer GUI.py AND try it.

@Erickesau
Copy link
Author

I used Windows 10 with Python 3.6 and work fine , maybe your tkinter versión not recognize the icon bitmap, delete líne 66 in Photo Restorer GUI.py AND try it.

I found in Google
https://stackoverflow.com/questions/54513452/iconbitmap-gives-tclerror-bitmap-ico-not-defined

that if you are using Linux or Ubuntu you have to use .xbm file as bitmap intead of .ico file so maybe that Is the problem, just delete líne 66 and letme know if the GUI work.

@joe-eis
Copy link

joe-eis commented Jan 29, 2023

Thank you very much for the timely response. You helped me a lot with the solution, it works. The format of the icon bitmap is the cause. This solves the problem of the GUI. Also, thank you for taking the time to do this.

Then I have only one problem: In the folder "restored_imgs" I have only cut out faces on black background.
But in the right position, like on the photo.
As if Real-SRGAN would not work.

But in the folder "restored_faces" I have the background in the cutout around the heads.

Do you have an idea what I can do about the problem with the missing background?

UPDATE !!
The background works. It was my fault, I had misinterpreted the Background Restorer selection. No check mark at Background Upsampler brings back the background.

Translated with www.DeepL.com/Translator (free version)

@Erickesau
Copy link
Author

sorry i have no idea about the missing background error but in the GUI you can enable or disable background processing with Real-SRGAN just uncheck the checkbutton so we can see if the error is caused by gfpgan or Real-srgan, if it doesn't work at all then it may be some library or the python version

@joe-eis
Copy link

joe-eis commented Jan 29, 2023

Thanks again. Of course, the problem also occurs in the base branch, but no one had reacted there yet.
I can now close the problem with the start of the GUI under Linux.

@joe-eis
Copy link

joe-eis commented Jan 29, 2023

FYI: "Python 3.6 tkinter window icon on Linux error" seems to be an often discussed topic.
*.ico is not mapped under Linux. But also the other formats are called differently with tkinter under Linux.

If I change the image format to png, I also get the error message:

   return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "assets/icon.png" not defined

But this construction works:

from tkinter import *
from tkinter.ttk import *
first = Tk()
imge = PhotoImage(file = r"assets/icon.png")
Button(image = imge).pack()
mainloop()

https://www.educba.com/tkinter-photoimage/

@Erickesau
Copy link
Author

PhotoImage Is used to show images in Any widget, while wm_iconbitmap Is used to show a miniature in the upper left corner of the program window but in Linux & Ubuntu probably only accepts *.xbm files

Líne 66 Disabled bitmap image because in Linux & Ubuntu give error
@joe-eis
Copy link

joe-eis commented Jan 30, 2023

GFPGAN$ file ./assets/icon.xbm 
assets/icon.xbm: xbm image (64x64), ASCII text

Yes, it really seems so, good old Tkinter reads iconbitmap in Linux in xbm format only.
After converting to this format and, on Linux, for whatever reason, you have to put an "@ " in front of the icon path:

self.wm_iconbitmap(bitmap="@assets/icon.xbm")

the start succeeds without errors.

[(https://stackoverflow.com/questions/20860325/python-3-tkinter-iconbitmap-error-in-ubuntu)]

@Erickesau
Copy link
Author

Very good thank you for sharing.

@the-overdriven
Copy link

@Erickesau Can you please elaborate how one should run the GUI?

Then I have only one problem: In the folder "restored_imgs" I have only cut out faces on black background.
But in the right position, like on the photo.
As if Real-SRGAN would not work.

But in the folder "restored_faces" I have the background in the cutout around the heads.

Do you have an idea what I can do about the problem with the missing background?

I had the same problem, bg_upsampler is enabled by default, passing --bg_upsampler None seems to fix the background.

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

Successfully merging this pull request may close these issues.

4 participants