TeaM-TL / FotoKilof

GUI for ImageMagick and Wand
MIT License
306 stars 17 forks source link

Preview is not shown when filename contains colons #189

Closed nivit closed 2 months ago

nivit commented 2 months ago

Describe the bug 1) the original image is not shown when the temporary directory contains a dot. 2) the preview of the new/converted image is not shown when the filename contains colons

To Reproduce

Steps to reproduce the behavior:

  1. mkdir ~/.tmp env TMPDIR=~/.tmp fotokilof (load an image) In the log file ~/.fotokilof.log appears the message:
    *** ERROR: preview_orig: Cannot load preview
  2. Try to load an image whose filename contains a colon; then the image is loaded, but when you execute a transformation the preview of the new image is not shown, and the app raises an exception:
    Exception in Tkinter callback
    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/tkinter/__init__.py", line 1967, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/site-packages/fotokilof/__main__.py", line 525, in convert_bw_button
    preview_new(path_to_file_out(0))
    File "/usr/local/lib/python3.11/site-packages/fotokilof/__main__.py", line 259, in preview_new
    gui.copy_to_clipboard(file_out, OS)
    File "/usr/local/lib/python3.11/site-packages/fotokilof/gui.py", line 51, in copy_to_clipboard
    image = Image.open(file_in)
            ^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/site-packages/PIL/Image.py", line 3431, in open
    fp = builtins.open(filename, "rb")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    FileNotFoundError: [Errno 2] No such file or directory: /usr/home/nivit/FotoKilof/20241001T105501:screenshot.jpeg

    Desktop

    • OS: FreeBSD
    • Version 14.1-RELEASE
    • FotoKilof version: 5.0.5
TeaM-TL commented 2 months ago

Many thanks for this bug report, I will fix it asap

TeaM-TL commented 2 months ago

fixed in 5.0.6. please test if really fixed

TeaM-TL commented 2 months ago

Linux has no problem with colon in filename, but macos stiil has problem :-( Under Windows is ok, because is imposible to add colon into filename

nivit commented 2 months ago

Hi, I can confirm that the issue with the dots has been fixed, but the problem with the colons is still there unfortunately. :-(

nivit commented 2 months ago

Maybe it is an issue of the Wand library, because if I force to use PILLOW all works fine. Besides if you try the first example at this page by replacing the output filename mona-lisa-{0}.png with mona:lisa-{0}.png, then the generated images have names lisa-1.png, lisa-2.png, etc. ; that is it discards the beginning part mona:.

EDIT: There is already a closed issue, and a possibile solution.

TeaM-TL commented 2 months ago

Many thanks for deep tests and looking for solution. I will correct code as was adviced

TeaM-TL commented 2 months ago

I think that this issue has been fixed in 5.0.7

nivit commented 2 months ago

I can confirm, thanks a lot!