jim-easterbrook / Photini

An easy to use digital photograph metadata (Exif, IPTC, XMP) editing application.
https://photini.readthedocs.io/
GNU General Public License v3.0
156 stars 24 forks source link

Error saving images #65

Closed jendib closed 2 years ago

jendib commented 2 years ago

Thanks for this great software.

I'm having issues when generating thumbnails and then saving the photos.

After "Fix missing thumbnails":

14:26:16: ERROR: photini.imagelist: [WinError 2] The system cannot find the file specified

After "Save changes":

14:26:18: ERROR: photini.metadata: <class 'photini.metadata.Thumbnail'> does not support item assignment
Traceback (most recent call last):
  File "c:\users\benjamin\appdata\local\programs\python\python38\lib\site-packages\photini\metadata.py", line 1237, in save
    OK = self._handler_save(
  File "c:\users\benjamin\appdata\local\programs\python\python38\lib\site-packages\photini\metadata.py", line 1219, in _handler_save
    handler.write(name, value)
  File "c:\users\benjamin\appdata\local\programs\python\python38\lib\site-packages\photini\filemetadata.py", line 488, in write
    file_value = value.to_exif()
  File "c:\users\benjamin\appdata\local\programs\python\python38\lib\site-packages\photini\metadata.py", line 626, in to_exif
    self['fmt'] = 'JPEG'
  File "c:\users\benjamin\appdata\local\programs\python\python38\lib\site-packages\photini\metadata.py", line 217, in __setitem__
    raise TypeError(
TypeError: <class 'photini.metadata.Thumbnail'> does not support item assignment

The image is located at C:\Users\Benjamin\Downloads\photoscans\out-000.jpg

Versions used:

Windows 10 19043.1348
Photini 2021.11.0, build 1872 (1714ac1)
  Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
  python-exiv2 0.8.1, exiv2 0.27.5
  PySide2 5.15.2, Qt 5.15.2, using QtWebEngine
  ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  available styles: windowsvista, Windows, Fusion
  using style: windowsvista
jim-easterbrook commented 2 years ago

Thanks for reporting this. I've managed to reproduce the "save changes" part of the problem, but not the "fix missing thumbnails" part, probably because I don't have FFmpeg on my Windows virtual machine.

jim-easterbrook commented 2 years ago

And now I've managed to recreate the problem on Linux as well. I'm surprised it didn't show up before. I'll get a new release out as soon as I can.

jim-easterbrook commented 2 years ago

I've found out why the problem escaped my attention - it's because I have Pillow / PIL installed. This is available for Windows and may get round the problem until I do a new Photini release. Try doing pip install pillow and see if it helps.

jim-easterbrook commented 2 years ago

I think the 14:26:16: ERROR: photini.imagelist: [WinError 2] The system cannot find the file specified is most likely because Photini can find the ffmpeg program but not its companion program ffprobe. Can you remember where you got ffmpeg from?

jim-easterbrook commented 2 years ago

I've just released version 2021.11.1 which I hope fixes both problems.

jendib commented 2 years ago

The new version works perfectly, thanks! And indeed I have ffmpeg but not ffprobe in my path. Why is Photini using ffprobe? Should I install it to have additional features? Same for Pillow?

jim-easterbrook commented 2 years ago

Photini has three possibilities when generating thumbnails. 1st choice is Pillow - it's fast and gives good image quality. 2nd choice is FFMpeg - also good quality, but not as quick. (It runs a command, which is slower than using a Python library.) 3rd choice is Qt - guaranteed to be there, but doesn't give very good image quality.

ffprobe is used to get the image dimensions, and find out if ffmpeg can open the image, before running the ffmpeg command itself.

(Note that FFMpeg is the only choice for thumbnails of videos.)

jendib commented 2 years ago

Got it thanks! I'm closing this issue since it's resolved.