VoxelCubes / PanelCleaner

An AI-powered tool to clean manga panels.
GNU General Public License v3.0
243 stars 18 forks source link

MagicException: cannot read magic file #87

Closed GH6 closed 7 months ago

GH6 commented 7 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior: I dropped in the folder, selected only the mask option, and pressed start. It looks like all the files are processed, then I get an error.

Expected behavior A clear and concise description of what you expected to happen.

Session Log

2024-05-01 00:01:07.162 | INFO | pcleaner.gui.launcher:launch:65 -

2024-05-01 00:25:44.663 | INFO | pcleaner.gui.processing:generate_output:225 - Running preprocessing for 56 images... 2024-05-01 00:25:44.664 | WARNING | pcleaner.gui.image_tab:update_tabs:122 - Updating tabs with step 1. 2024-05-01 00:25:44.664 | DEBUG | pcleaner.preprocessor:prep_jsonfile:68 - Processing json file: C:\Users\\AppData\Roaming\pcleaner\cache\cleaner\633064b1-b138-443b-8192-8cbec3f73b32@new_05_Chieri_san2_02_001#raw.json 2024-05-01 00:25:44.667 | CRITICAL | pcleaner.gui.mainwindow_driver:output_worker_error:1421 - Encountered an error while processing files. Traceback (most recent call last):

File "pcleaner\gui\worker_thread.py", line 141, in run

File "pcleaner\gui\mainwindow_driver.py", line 1303, in generate_output

File "pcleaner\gui\processing.py", line 241, in generate_output

File "pcleaner\preprocessor.py", line 115, in prep_json_file

File "pcleaner\structures.py", line 246, in grow_boxes

File "pcleaner\structures.py", line 208, in image_size

File "magic\magic.py", line 134, in from_file

File "magic\magic.py", line 122, in _get_magic_type

File "magic\magic.py", line 71, in init

File "magic\magic.py", line 272, in magic_load

File "magic\magic.py", line 203, in errorcheck_negative_one

magic.magic.MagicException: b"cannot read magic file `C:\\xec\x9e\x91\xec\x97\x85\PanelCleaner-Windows-unzip_me\_internal\magic\libmagic\magic.mgc' (Illegal byte sequence)" 2024-05-01 00:33:09.449 | DEBUG | pcleaner.gui.mainwindow_driver:open_issue_reporter:728 - Opening issue reporter.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

+Only partial logs were entered due to character limitations.

VoxelCubes commented 7 months ago

An illegal byte sequence error sounds like something caused by the magic library choking on Hangul characters, if I had to guess. Are you able to share the image causing the issue with me, so I can figure out a workaround? If not here, then privately to my email voxel.aur@gmail.com Thanks.

VoxelCubes commented 7 months ago

Thanks for the test files, I'll take a look over the weekend.

GH6 commented 7 months ago

One of the directories had a Korean name. I changed it to an English name and it worked.

VoxelCubes commented 7 months ago

Aha, so it was indeed the hangul characters. Not sure I'll be able to fix that, likely to do with Windows' weird character encoding. The failures are completely normal behavior, caused by sfx that are overlapping the actual art, so it doesn't clean those. You can enable inpainting and see if it does a good job on the ones it skipped.

GH6 commented 7 months ago

I'll refer back to the guide to set up the profile, as I didn't understand the program well enough. And I have one more question. If I use this program to translate manga and make my work public, do I need to put the program logo or a link to GitHub in the work image?

VoxelCubes commented 7 months ago

To enable inpainting in the gui, you go to the inpainting section of the profile settings and check "enable inpainting", then press apply. You can also save the profile to make that more convenient.

You do not need to attribute this project for stuff you used it for. The only license here is in regards to using the source code, the GPLv3 license.

Feel free to let other people know you used it, if you want more people to know about it, but you don't have to do any of that.

I'm not sure I can actually fix your issue, since this problem occurs in the program code of imagemagic, rather than panel cleaner. We'll see.