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

Ignore my folder choice and keep JPEG bigger than originals #14

Closed
Bonbadil opened this issue Sep 30, 2021 · 4 comments
Closed

Ignore my folder choice and keep JPEG bigger than originals #14

Bonbadil opened this issue Sep 30, 2021 · 4 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Bonbadil
Copy link

Hello,
I've read you post on linuxfr.org and decided to give it a try on my personal photo library.
I downloaded on github the windows installer version 1.1.1, installed it and launch it.
I drop my photo folder (576 JPEG and 18 videos) in it and see the pictures listed.
I changed my preferences to put the threads number to 4 and use a file template "C:\Users\ME\Pictures\test\optimized{FILENAME}.{EXT}" because I didn't want the result of this test to be directly uploaded on my owncloud. To be sure, I've disabled to synchro.

3 problems arise:

  1. Only 75 JPEG were in fact listed in the program, when the folder contained 500+. It should list all the JPEG in the program, and show the number somewhere to be sure, and to be able to see the progress of a mass optimization.
  2. The optimised files use the default {FILENAME}.opti.{EXT} file template and not my custom template.
  3. I've stopped when 8 JPEG were processed because of the precedent issue, and 3 of them where bigger than originals. I've checked again your post on linuxfr.org and see you talked about test of the original size of PNG files only. If the compressed JPEG are bigger than originals ones, the original should be used. Otherwise I would need to check the gain one by one between the two folders to only keep the good ones.

Thank you for your work and sorry for this unique GitHub issue with several problems.

@flozz
Copy link
Owner

flozz commented Oct 1, 2021

Hello,

  1. I do not know why only 75 images where added an not the whole folder... I cannot reproduce this on Linux, I will try on Windows.
    • But adding a lot of image is slow (it take too much time to create the thumbnails, I have to make this async)
    • Yes it should be possible to add a counter somewhere
  2. If you changed the setting after adding the images, it is normal: this will be applied only for new images (it is the default name for new images). To change already added images you can select them all and click the button next to the "Output file name" field.
    image
  3. There still work about this (while optimizing image only, and not while both converting and optimizing). We cannot just keep the input image as YOGA must ensure that metadata are removed from output images.

I still have a lot of work on this software, but I will improve it version after version :)

@Bonbadil
Copy link
Author

Bonbadil commented Oct 1, 2021

Hello,

OK for point 2. It is clear when you have understood it. :-) And it's even already stated in the preference pane: "by default".
OK for point 3.

For point 1, I've checked again, and in fact YOGA can't list some of my JPEG. In fact, a lot.
It failed silently to load these photos and abort silently to add the nexts. This is a sample.
IMG_20170913_193559

Bon weekend !

@flozz
Copy link
Owner

flozz commented Oct 1, 2021

Ok, here is the error while opening the image:

Traceback (most recent call last):
  File "/home/fabien/devel/public/yoga-image-optimizer/yoga_image_optimizer/main_window.py", line 375, in _on_drag_data_received
    _add_path([path])
  File "/home/fabien/devel/public/yoga-image-optimizer/yoga_image_optimizer/main_window.py", line 370, in _add_path
    app.add_image(path)
  File "/home/fabien/devel/public/yoga-image-optimizer/yoga_image_optimizer/application.py", line 178, in add_image
    preview=helpers.preview_gdk_pixbuf_from_image(image),
  File "/home/fabien/devel/public/yoga-image-optimizer/yoga_image_optimizer/helpers.py", line 98, in preview_gdk_pixbuf_from_image
    for operation in ORIENTATION_OPERATIONS[orientation]:
KeyError: 0

There is also the same error in YOGA (the lib):

$ yoga image 135634187-3e63f1f3-aa41-41cb-8156-e08807b13e60.jpg out.jpg
Traceback (most recent call last):
  File "/home/fabien/wanadev/devel/public/yoga/__env__/bin/yoga", line 33, in <module>
    sys.exit(load_entry_point('yoga', 'console_scripts', 'yoga')())
  File "/home/fabien/wanadev/devel/public/yoga/yoga/__main__.py", line 25, in main
    print(future.result())
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 438, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/fabien/wanadev/devel/public/yoga/yoga/image/__init__.py", line 211, in optimize
    image = open_jpeg(image_file)
  File "/home/fabien/wanadev/devel/public/yoga/yoga/image/encoders/jpeg.py", line 65, in open_jpeg
    for operation in ORIENTATION_OPERATIONS[orientation]:
KeyError: 0

The value of the orientation tag is 0 but this is not a valid value for this tag... I have to handle invalid values... Nice catch 👌

@flozz
Copy link
Owner

flozz commented Sep 22, 2022

I opened individual issues for each problem and evolution listed here so I close this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants