Coder Social home page Coder Social logo

flozz / yoga-image-optimizer Goto Github PK

View Code? Open in Web Editor NEW
138.0 3.0 11.0 1.18 MB

A graphical tool to convert and optimize JPEG, PNG and WebP images (based on YOGA)

Home Page: https://yoga.flozz.org

License: GNU General Public License v3.0

Python 89.15% Batchfile 3.59% Shell 3.41% Inno Setup 1.96% Roff 1.74% CSS 0.15%
image optimization guetzli zopfli zopflipng jpeg png webp mozjpeg

yoga-image-optimizer's Introduction

YOGA Image Optimizer

GitHub License Discord Github Actions Black

YOGA Image Optimizer is a graphical user interface for YOGA Image that converts and optimizes the size of JPEG, PNG and WebP image files.

Requirements

  • PyCairo
  • PyGObject ≥ 3.36
  • Python ≥ 3.8
  • YOGA ≥ 1.1.0

Installation

Arch Linux

The package is available on AUR (yoga-image-optimizer):

Flatpak (Linux)

A Flatpak package is available on Flathub. This is currently the simplest way to install YOGA Image Optimizer on all major Linux distributions:

Linux (PyPI)

You must install the dependencies on your system first. It can be done via the following command on Debian and Ubuntu:

sudo apt install git build-essential python3 python3-dev python3-pip libgirepository1.0-dev libcairo2-dev pkg-config gir1.2-gtk-3.0

Then install YOGA Image Optimizer with pip:

sudo pip3 install yoga-image-optimizer

NOTE: Installing from PyPI will not install .desktop file and manual page; you will not be able to run the software from your graphical app menu (GNOME Shell etc.).

Linux (source)

You must install the dependencies on your system first. It can be done via the following command on Debian and Ubuntu:

sudo apt install git build-essential python3 python3-dev python3-pip libgirepository1.0-dev libcairo2-dev pkg-config gir1.2-gtk-3.0

Then clone this repository and navigate to it:

git clone https://github.com/flozz/yoga-image-optimizer.git
cd yoga-image-optimizer

Then install YOGA Image Optimizer using pip:

sudo pip3 install .

Finally, you can install the .desktop file, icons and manual page using the following command:

sudo ./linuxpkg/copy-data.sh /usr

Windows

Download either the portable .zip version or the Windows installer from the releases page:

Usage

Just type the following command to run YOGA Image Optimizer:

yoga-image-optimizer

You can also give some image files to open:

yoga-image-optimizer  image1.png  image2.jpeg

NOTE: If you installed YOGA Image Optimizer from Flathub, you will have to run the following command instead:

flatpak run org.flozz.yoga-image-optimizer  image1.png  image2.jpeg

Contributing

Questions

If you have any question, you can:

Bugs

Please open an issue on GitHub with as much information as possible if you found a bug:

  • Your operating system / Linux distribution (and its version)
  • How you installed the software
  • All the logs and message outputted by the software
  • etc.

Pull requests

Please consider filing a bug before starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.

Please note that your code must follow the coding style defined by the pep8 and pass tests. Black and Flake8 are used on this project to enforce the coding style.

Translate YOGA Image Optimizer

You can help translating it if the software is not available on your language.

To translate YOGA Image Optimizer, you can submit your translations creating a pull request on GitHub.

Do not forget to add your name as the translation of the translator-credits key (one name per line, email is optional):

#: yoga_image_optimizer/about_dialog.py:38
msgid "translator-credits"
msgstr ""
"John DOE\n"
"Other TRANSLATOR <[email protected]>\n"

Run the tests

You must install Nox first:

pip3 install nox

Then you can check for lint error:

nox --session lint

or run the tests:

nox --session test

You can use following commands to run the tests only on a certain Python version (the corresponding Python interpreter must be installed on your machine):

nox --session test-3.8
nox --session test-3.9
nox --session test-3.10
nox --session test-3.11
nox --session test-3.12

You can also fix coding style errors automatically with:

nox -s black_fix

Build, extract or update build translations

You must install Nox first:

pip3 install nox

To extract messages and update locales, run:

nox --session locales_update

To compile locales, run:

nox --session locales_compile

NOTE: you must have msgfmt, msgmerge and xgettext executable installed on your system to run the above commands. It can be done via the following command on Debian and Ubuntu:

sudo apt install gettext

Support this project

Want to support this project?

Changelog

  • [NEXT] (changes on master, but not released yet):
    • Nothing yet ;)
  • v1.2.4:
    • i18n: Updated Occitan translation (@Mejans, #53)
    • misc: Added Python 3.12 support (@flozz)
    • misc!: Removed Python 3.7 support (@flozz)
  • v1.2.3:
    • Fixed crash when the system locale cannot be determined (@flozz, #43)
  • v1.2.2:
    • Bug fix:
      • Fixed an issue that prevents the update of the view with older Pango versions (@flozz, #41)
    • Translations:
      • Updated Italian translation (@albanobattistella, #39)
      • Updated Spanish translation (@haggen88, #42)
  • v1.2.1:
    • Fixes / improvements:
      • Flatpak: use the real user cache, not the one of the Flatpak application (@flozz)
      • Added Python 3.11 support (@flozz)
    • Translations:
      • Added Brazilian Portuguese translation (@Kazevic, #36)
      • Completed Dutch translation (@Vistaus, #34)
  • v1.2.0:
    • Interface / user experience:
      • More compact and less bloated interface (#17)
      • Allow opening input images in the default image viewer by double-clicking them
      • Asynchronous generation and loading of thumbnails to not freeze the interface when importing a lot of images (#26)
      • Sped up thumbnail loading on Linux by using already generated thumbnails from the shared cache
      • Sped up thumbnail generation using BOX sampling instead of LANCZOS
      • Show a warning icon if the output image is larger than the input one
    • Fixes / improvements:
      • Fixed a crash when generating thumbnails for JPEGs with an invalid orientation EXIF tag (#29)
      • Fixed a crash on the image import process when generating a broken image's thumbnail (#27)
      • Fixed a crash on the optimization batch if an error occurs when optimizing an image (#27)
      • Fixed inverted width and height with rotated JPEGs
      • Fixed issues related to concurrent.futures on Python 3.7 and 3.8 (#32)
      • Updated the code to not use deprecated constants on newer Pillow versions
    • New translations:
      • Dutch (incomplete) (@Vistaus, #25)
      • German (Jürgen Benvenuti)
  • v1.1.2:
    • New translations:
      • Russian
      • Spanish
    • Updated translation:
      • Turkish
  • v1.1.1:
    • Fixed the abnormal amount of processes created and not cleaned when starting an optimization (#13)
  • v1.1.0:
    • YOGA updated to v1.1.0:
      • Honor the JPEG orientation EXIF tag
      • JPEG optimization improved: up to 7.3% of additional size reduction since previous version
      • YOGA can no more output a PNG larger than the input one when performing a PNG to PNG optimization
    • Added a setting window:
      • Number of threads used to optimize images
      • Setting the default output locations / name or pattern of output files
      • Theme selection / dark theme preference
    • "Optimize" and "Stop" buttons behaviour improved:
      • The "Stop" button now stops the running optimizations, not just the pending ones
      • Display a "Canceled" status on non-optimized image while the "Stop" button is clicked
      • Do not optimize again images that have already been optimized
    • Allow to resize images (downscale only, preserve ratio)
    • Multiselection: multiple files can now be selected and their parameters can be edited all at once (multiselection)
    • Windows specific changes:
      • Use the Adwaita theme by default on Windows; the Windows10 GTK theme looks buggy
    • Fixes / improvements:
      • Do not allow to remove images with the <Del> key while an optimization is in progress
      • Fixed image previews; no more ugly thumbnails with indexed images
      • Image previews now honor the JPEG orientation EXIF tag
    • Updated translations:
      • French
      • Italian (partial)
      • Occitan
      • Turkish (partial)
    • Note for packagers:
  • v1.0.1:
    • Fixed PyPI packages
    • NOTE: No new version for Windows; nothing changed
  • v1.0.0:
    • Fixed [-] button not removing the chosen image
    • Updated site URL
  • v0.99.2 (beta):
    • Fixed package data not installed while installing with pip (#3)
    • NOTE: No new version for Windows; nothing changed
  • v0.99.1 (beta):
    • Fixed site URL in setup.py
    • Fixed version number
  • v0.99.0 (beta):
    • Initial release
    • Linux and Windows support
    • Optimizes JPEG, PNG and WebP image formats

yoga-image-optimizer's People

Contributors

albanobattistella avatar dblackcat avatar dependabot[bot] avatar flozz avatar haggen88 avatar kazevic avatar kianmeng avatar mejans avatar oltulu avatar vistaus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yoga-image-optimizer's Issues

Markup error on Windows

Bug description

What happened

The text of the output column is not updated after an optimization is finished. The logs in the console complains about an invalid value for the size attribute in the text markup:

image

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:

Just optimize any image on Windows

System information

  • Operating system (with version): [Ubuntu 20.04, ArchLinux, Windows 10,...]

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other (build from master)
  • YOGA Image Optimizer version: v1.2.0

Exceptions when thumbnailing JPEGs with inalid orientation EXIF tag

Traceback (most recent call last):
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 342, in _invoke_callbacks
    callback(self)
  File "/home/fabien/devel/public/yoga-image-optimizer/yoga-image-optimizer.git/yoga_image_optimizer/application.py", line 231, in _thumbnail_callback
    pixbuf = future.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File ".../yoga_image_optimizer/helpers.py", line 111, in preview_gdk_pixbuf_from_image
    for operation in ORIENTATION_OPERATIONS[orientation]:
KeyError: 0

related issues: #14, wanadev/yoga#38

Not opening on Windows 11

Bug description

Using Portable and MSI installer, all version I've tried (down to, and including, 1.1.2) does not open at all.

What happened

Simply use Portable or MSI installer

What was expected

Program to open the GUI

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:

  • Install MSi or Extract Portable files
  • Attempt to open the program through shortcut or .exe

System information

  • Operating system (with version): [Ubuntu 20.04, ArchLinux, Windows 10,...]

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other (please provide any useful information like command you use, a link to a documentation,...)
  • YOGA Image Optimizer version: 1.2.2 -> 1.1.2

Extra information

I did not find logs anywhere, it could most likely help but I do not know where to search.

Ability to trade off guetzli+mozjpeg's "perfect optimization" for a faster "mozjpeg-only" live encoding mode

Bonjour,
Yoga is a very interesting app, and it could almost replace Squoosh for me, were it not for the excruciatingly slow guetzli-based JPEG encoding.

I would like to have the ability to have Yoga encode purely with MozJPEG instead of needing all this fancy AI perceptual encoding stuff. I value mozjpeg's 0.5 second encoding time much more than absolute perfect quality (because if I was looking for perfection, I'd be doing JPEG XL ;) Waiting 2 minutes per HD JPEG is too much for me, especially when you are batch-encoding hundreds of them (I don't want to wait hours with my 8-cores Xeon pegged burning at 100% utilization, for what would take a minute or two with mozjpeg), or when I am encoding them one by one on a "as needed" basis (like I would do with Squoosh) when doing web integration work; in that particular case I am processing images one by one, as they come and as the website is being built, so having to wait over a minute for each image interrupts my work.

I would like to be able to set a standard preferred size to downsize to, standard preferred encoder (mozjpeg for JPEGs), drag and drop files into the app, hit convert... actually, mozjpeg is so fast to convert that you would not even need to have a convert button, you could create and live-overwrite/update the file in realtime!

Ignore my folder choice and keep JPEG bigger than originals

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.

[JPG-optimisation] - OSError: [Errno 9] Mauvais descripteur de fichier

Hi Flozz,

Bug description

Exception in thread QueueManagerThread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/concurrent/futures/process.py", line 376, in _queue_management_worker
    thread_wakeup.clear()
  File "/usr/lib/python3.8/concurrent/futures/process.py", line 94, in clear
    self._reader.recv_bytes()
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 216, in recv_bytes
    buf = self._recv_bytes(maxlength)
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
    buf = self._recv(4)
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 379, in _recv
    chunk = read(handle, remaining)
OSError: [Errno 9] Mauvais descripteur de fichier

What happened

An exception as been raised.

What was expected

No exception.

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:
I have chosen an image in JPG format, start the optimization process. When the optimization finished, an exception was thrown.

System information

  • Operating system (with version): Ubuntu 20.04

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other (please provide any useful information like command you use, a link to a documentation,...)
  • YOGA Image Optimizer version: 1.0.1

Exception in thread QueueManagerThread

Bug description

A exception has been raised

What happened

The file has been optimized, but a Exception as been throwen (sorry for my english)

Error

Exception in thread QueueManagerThread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/concurrent/futures/process.py", line 376, in _queue_management_worker
    thread_wakeup.clear()
  File "/usr/lib/python3.8/concurrent/futures/process.py", line 93, in clear
    while self._reader.poll():
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 255, in poll
    self._check_closed()
  File "/usr/lib/python3.8/multiprocessing/connection.py", line 136, in _check_closed
    raise OSError("handle is closed")
OSError: handle is closed

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:
Just run an optimization (for a big file of 250ko) it took long time then finish with this error

System information

  • Operating system (with version): Ubuntu 20.04

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other (please provide any useful information like command you use, a link to a documentation,...)
  • YOGA Image Optimizer version: 1.1.1

Error when optimizing a JPEG (Flatpak package)

Bug description

What happened

Optimization crashes when output format is JPEG. This occurs only with the Flatpak package, it works when running from master version.

What was expected

Not crashing.

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:

  • Add an image
  • Set output format to JPEG
  • Click the "Optimize" button

System information

  • Operating system (with version): [Ubuntu 20.04, ArchLinux, Windows 10,...]

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other: Flatpak package from Flathub
  • YOGA Image Optimizer version: v1.2.0


Screenshot:

image

Logs:

$ flatpak run org.flozz.yoga-image-optimizer
/usr/include/c++/12.1.0/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = float; _Alloc = std::allocator<float>; reference = float&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
E: An error occurred when optimizing '.../yoga-image-optimizer.git/screenshot.png': A process in the process pool was terminated abruptly while the future was running or pending.

When doing lossless transcoding in the same folder, and the resulting filesize is smaller, offer to move the original files to Trash

I very often optimize my PNG screenshots losslessly with Yoga, and it generates a bunch of .opti.png files (the suffix is useful for me to know that those files have already been optimized and nothing more can be done with them). I don't want to use a subfolder, so the in-same-folder-with-different-name trick is convenient enough.

However, I still have to wait after Yoga and remember to throw all the originals to the trash afterwards. It would be nice if there was an option in the settings to "Automatically move originals to the Trash when lossless recompression successfully reduced filesize"?

sometimes GTK warning appears when try to optimize a file

Bug description

sometimes, a GTK warning is logged when I try to optimize a file

The warnings appears but seems not a problem to the program

What happened

$ yoga-image-optimizer ~/Images/Papiers\ peints/dark-unie.opti.jpg 

(yoga-image-optimizer:4984): Gtk-WARNING **: 15:36:19.402: Failed to set text from markup due to error parsing markup: Value of 'size' attribute on <span> tag on line 2 could not be parsed; should be an integer no more than 2147483647, or a string such as 'small', not '75%'

(yoga-image-optimizer:4984): Gtk-WARNING **: 15:36:19.404: Failed to set text from markup due to error parsing markup: Value of 'size' attribute on <span> tag on line 2 could not be parsed; should be an integer no more than 2147483647, or a string such as 'small', not '75%'

(yoga-image-optimizer:4984): Gtk-WARNING **: 15:36:19.405: Failed to set text from markup due to error parsing markup: Value of 'size' attribute on <span> tag on line 2 could not be parsed; should be an integer no more than 2147483647, or a string such as 'small', not '75%'

However the optimization works and produces the output :)

Step to reproduce

  • Use a file who generate the warning

Open a image who will generate the warning with yoga-image-optimizer and Optimize

by example with this file : http://gabriel-theuws.fr/dark-unie.opti.jpg

System information

  • Operating system (with version): Ubuntu 20.04

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer
  • YOGA Image Optimizer version: 1.2.0

Corrupted images are not handled properly

Bug description

What happened

If there is a corrupted image when dropping a bunch of file on the app window, the import process crash and other images are not imported.

What was expected

When a corrupted image is imported,

  • the app must continue importing other image after encountering the corrupted one
  • and at the end of the import, a message should warn the user about the corrupted image(s)

Step to reproduce

  • The bug is always reproducible
  • The bug seems to appear randomly

Steps to reproduce:

Just drag & drop some image with one corrupted.

System information

  • Operating system (with version): Ubuntu 22.04

  • How did you installed the software?

    • From PyPI (pip3 install yoga-image-optimizer)
    • From source
    • Windows Installer
    • Windows Zip
    • Other: working from the master branch
  • YOGA Image Optimizer version: master (c60c29a510716cdb603d12f6e668d4b767b8b622)

Stack trace:

Traceback (most recent call last):
  File "yoga_image_optimizer/main_window.py", line 422, in _on_drag_data_received
    _add_path([path])
  File "yoga_image_optimizer/main_window.py", line 417, in _add_path
    app.add_image(path)
  File "yoga_image_optimizer/application.py", line 183, in add_image
    preview=helpers.preview_gdk_pixbuf_from_image(image),
  File "yoga_image_optimizer/helpers.py", line 92, in preview_gdk_pixbuf_from_image
    image_rgba.paste(image)
  File "__env__/lib/python3.10/site-packages/PIL/Image.py", line 1617, in paste
    im.load()
  File "__env__/lib/python3.10/site-packages/PIL/ImageFile.py", line 276, in load
    raise_oserror(err_code)
  File "__env__/lib/python3.10/site-packages/PIL/ImageFile.py", line 71, in raise_oserror
    raise OSError(message + " when reading image file")
OSError: broken data stream when reading image file

Related issue: #14

Show a desktop notification when done processing in the background

I often throw a dozen of PNG images at Yoga to optimize, but encoding often takes a very long time. Usually I either switch away to another application and then forget to come back to Yoga's results, or I just sit in front of Yoga, which is improductive.

It would be nice if Yoga could emit a "transient" freedesktop notification just to visually let me know when it's done, so that I can go back to it from whatever else I was doing in another application, if needed.

Add option to preserve metadata

There are a number of situations where I want to compress and resize images for work, but need to preserve the metadata (like copyright information and the description), even though it adds to the file size. Having a setting that allows you to preserve this data would be amazing.

I love this tool! Thank you so much for creating it. I use it near daily.

Important usage of processors

Bug description

I installed Yoga from Flatpak, then run a little test with 3 pictures, 6MB in total

What happened

A lot of resources are used by Yoga:

Capture d’écran de 2021-08-30 03-37-23

After a few minutes, I had to kill the process

What was expected

Optimize the pictures and keep the computer usable ;)

System information

  • Operating system (with version): Debian 10

  • How did you installed the software?

https://flathub.org/apps/details/org.flozz.yoga-image-optimizer

  • YOGA Image Optimizer version:

Version 1.0.0

Additional infos

I'm not familiar with Flatpak, is there a way to get relevant logs to report here?

JPEG XL transcoding feature (for big JPEG collections)

The biggest potential I see for this application is to be able to shrink down the heavy weight of my big photo gallery/storage on my computer, as I'm always running out of disk space. Yoga supporting JPEG XL would be a huge deal. It would be the most efficient image codec, and it would be an order of magnitude faster to encode than anything Yoga currently does.

JPEG XL can losslessly recompress/optimize existing JPEG images. There's just no downside.


Context: JPEG XL is the future of all image formats. It is a new royalty-free image codec targeting the image quality as found on the web, providing about 60% size savings when compared to original JPEG at the same perceptual quality, while supporting modern features like HDR, animation, alpha channel, lossless JPEG recompression, lossless and progressive modes. It is based on Google's PIK and Cloudinary's FUIF, and is an ISO standard.

Explanation here: https://www.slideshare.net/cloudinarymarketing/imagecon-2019-jon-sneyer

Reference implementation here: https://github.com/libjxl/libjxl/

Adoption:

  • Epiphany 45 / WebKitGTK, Safari 17 / WebKit and all iOS devices since Q4 2023 support JPEG XL out of the box.
  • Firefox's dev version has an initial implementation
  • Imagemagick already supports JPEG XL; for GD I filed a ticket at libgd/libgd#699
  • Image viewers like gThumb, Loupe, etc. (many others) already support JPEG XL out of the box.
  • ...and others

/data/images folder missing after install with PyPi

Bug description

What happened

I installed YOGA using PyPi, but I can't launch it: gi.repository.GLib.Error: g-file-error-quark: Failed to open file “/usr/local/lib/python3.8/dist-packages/yoga_image_optimizer/data/images/icon_64.png”: No such file or directory (4)
It appears that /usr/local/lib/python3.8/dist-packages/yoga_image_optimizer/data/images/ folder does not exist.

What was expected

It works out of the box

Step to reproduce

  • The bug is always reproducible

Steps to reproduce:

Install via PyPi, following readme instruction.

System information

  • Operating system (with version): Ubuntu 20.10
  • How did you installed the software?
    • From PyPI (pip3 install yoga-image-optimizer)

On Windows the "Number of threads" setting doesn't seem to work correctly

On Windows 1.1.0 doesn't seem to use that Setting correctly the whole time

Eg. For each file a thread is created on "Optimize" start, not when it actually processes the actual file. Making the machine behave oddly under the load, since if you have 1000 files to optimize it will create 1000 threads each using memory and resources, and each using 100% of one core for setting up. The system will starve at one point making even input erroneous (trying to write letters will input ljk!@@21';s/.//, so the letters and random punctuation signs). After the threads are created THEN it will start to use only X CPU threads as setup, if the machine still works that is :(

/LE: reworded for clarity

Originally posted by @licaon-kter in #11 (comment)

GTK4 port + FreeDesktop automatic light/dark theme support

I suppose you're already aware of all these things, but at least this is a ticket for tracking this, and maybe in case someone wants to help with this...

It would be a good thing to:

assets are not installed while installing from pypi package

$ yoga-image-optimizer 
Traceback (most recent call last):
  File "/home/jbghoul/dev/yoga-image-optimizer/__env__/lib/python3.8/site-packages/yoga_image_optimizer/application.py", line 81, in do_activate
    self._main_window = MainWindow(self)
  File "/home/jbghoul/dev/yoga-image-optimizer/__env__/lib/python3.8/site-packages/yoga_image_optimizer/main_window.py", line 20, in __init__
    icon=GdkPixbuf.Pixbuf.new_from_file(
gi.repository.GLib.Error: g-file-error-quark: Impossible d’ouvrir le fichier « /home/jbghoul/dev/yoga-image-optimizer/__env__/lib/python3.8/site-packages/yoga_image_optimizer/data/images/icon_64.png » : Aucun fichier ou dossier de ce type (4)

Write to and open temporary folder instead

Great work and thanks for sharing!

Instead of the "Output file" field, I would like to suggest creating a temporary folder instead and upon completion open it with the default file manager. The folder would contain the list of output files.

As a user, I can then simply move/copy/drag'n drop the files to the desired location(s).

Here are a few pros to this approach if you're not conviced

  1. The input files are usually not where you want the output files to be (~/Downloads)
  2. Output files are usually meant to be in the same folder .../assets
  3. Works best for bulk with source files from different location
  4. Immediately let the user organize the output files
  5. Remove the need for flatpak --filesystem=host permission flathub/flathub#2376

I guess the only con is that user action is required after completion but I can't imagine use cases for optimizing files and not moving them around afterwards anyway.

Crash on Python 3.7 related to treading / concurrent.future

Error encountered in Python 3.7.14. No issue in 3.10.7 though. Manage different Python versions using pyenv.

Steps to reproduce:

git clone https://github.com/flozz/yoga-image-optimizer.git
cd yoga-image-optimizer
sudo pip3 install .

Stacktrace:

$ yoga-image-optimizer
...
Exception in thread QueueManagerThread:
Traceback (most recent call last):
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/threading.py", line 926, in _bootstrap_inner                                                                                     self.run()
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs)                                               File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/concurrent/futures/process.py", line 375, in _queue_management_worker
    thread_wakeup.clear()                                                                   File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/concurrent/futures/process.py", line 93, in clear
    while self._reader.poll():
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/multiprocessing/connection.py", line 255, in poll
    self._check_closed()
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/multiprocessing/connection.py", line 136, in _check_closed
    raise OSError("handle is closed")
OSError: handle is closed

Traceback (most recent call last):
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/site-packages/yoga_image_optimizer/main_window.py", line 385, in _on_main_window_destroyed
    app.quit()
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/site-packages/yoga_image_optimizer/application.py", line 142, in quit
    self._thumbnailer.cancel_all()
  File "/home/foobar/.pyenv/versions/3.7.14/lib/python3.7/site-packages/yoga_image_optimizer/thumbnailer.py", line 156, in cancel_all
    self._executor.shutdown(wait=False, cancel_futures=True)
TypeError: shutdown() got an unexpected keyword argument 'cancel_futures'

Originally posted by @kianmeng in #30 (comment)

Make thumbnail generation asynchronous

Adding a lot of (big) image freezes the app because of the thumbnail generation being synchronous. The thumbnail generation should be done asynchronously.

Capture d’écran du 2022-09-22 13-48-29

Original issue: #14

Remove Metadata.

Would be great if Yoga included the option to remove Metadata during conversion.

Warn about lack of folder permissions due to flatpak sandbox restrictions

I'm running the flathub flatpak version, on Fedora 33.

If I have some images such as /tmp/foo bar/blahblah_001.PNG, and drag them into Yoga, nothing happens at all. No errors in the GUI, no errors in the terminal. I thought maybe flatpak's sandbox is preventing Yoga from getting those files (but in that case it should warn me clearly about it), but when I launched flatseal I saw that Yoga already had filesystem=host permissions, so why is it unable to read something from tmp ?

Conflict between images with the same name but different extensions

Bug description

When you try to optimize multiple images to the same output format, images with the same name but a different file extension will conflict with each other.

What happened

I tried optimizing a bunch of images to WebP and a few of them had the the same name, but with a different file extension. In this case, I noticed that only one of the images will get optimized. Ex: test.png and test.jpeg will (silently) conflict, and only the former test.png will get placed in the output folder as test.opti.webp, even though the app shows test.jpeg as completed.

What was expected

Both images should get optimized and be placed in the output folder, with some sort of renaming. Ex: test.opti.webp and test(1).opti.webp

Step to reproduce

  • The bug is always reproducible

Steps to reproduce:

  • Place two images with the same name, but a different extension into the app
  • Select the same output format for all images
  • Optimize
  • Only one image will be placed in the output folder.

System information

Fedora, installed from Flatpak.

Version 1.1.1

Add stats

Add a way to display some stats:

  • number of images
  • total input size
  • total output size
  • (duration of the last optimization)?

Original issue: #14

Freeze at "In Progress"

Conversion status freezes at "In Progress". Conversions are never completed.

The issue only occurred since the latest 1.1.2 update (flatpak)

Encountered the same issue on fully updated versions of both PopOs & Manjaro.

UI too wide to be usable on most screens

Running the Flathub flatpak version.

I rarely have simple and short filenames. The UI is extremely wide because of this, and requires resizing the window's width to somewhat unreasonable sizes in order to be able to see all columns, namely the "Output size" to see how efficient the result was.

I mean, it barely fits on my 2560px-wide screen, and yet I typically do not want a small utility app's window to take more than half of my screen width, it's supposed to be a companion app rather than a centerpiece.

I'm not sure how to solve this elegantly, but here are some ideas.

  • I'm not sure the "output image" column is useful at all. But if it is, consider putting that text on a 2nd line below the "input image" text string, separated by a line break character, and using some 50% opacity for the 2nd line or something...
  • The Input size and Output size columns should be grouped next to each other, I think those are the most important pieces of information. So move the "Output size" column to be right after "Input size", or put its information on a 2nd line using a linebreak?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.