Very rarely an image being optimized through command line doesn't close the...
Javier Gutiérrez Chamorro (Guti) Open source projects
Brought to you by:
nikkho
The tool I wrote fires off FileOptimizer multiple times to optimize different images on my system. However for some reason when I walked to my pc this morning (after kicking it off yesterday evening) and I saw that one window of FileOptimizer was still open. (See attached image)
It also states in the title bar that 0/1 images are optimized even though the image is optimized.
Can you share your tool so I can reproduce the issue?
Hey, yes sure, you can download it here from the releases page:
https://github.com/devedse/DeveImageOptimizerWPF
Make sure that in the configuration you activate parallelization, and yeah quick note, it took literally a full night of optimizing with 8 threads, going through 1000's of images to encounter this.
Last edit: Devedse 2018-11-16
Shall we close the ticket?
Hi Nikkho, I still have it happening quite often when running my tool which kicks of your tool on my images. Sometimes it simply doesn't close and stays at 0 / 1 files. E.g.

Somehow it just seems that when the state of an Image is set to "Done" the complete counter is not updated always.
Last edit: Devedse 2019-05-01
From doing a bit of investigation it seems to go to this line of code:

I'm not sure if it should go in there as there's only 1 item in the grid.
Last edit: Devedse 2019-05-01
Doing some more investigation it seems that this happens if you kick off FileOptimizerFull multiple times at once in parallel. Could it be due to writing back to the config file? (E.g. the total number of files optimized)
Hi @nikkho, I know it's been a while, but this issue is still happening. Especially if you run the tool in parallel it quickly happens quite often:

To easily run your tool in parallel you can install my DeveImageOptimizer using chocolatey:
https://chocolatey.org/packages/DeveImageOptimizerWPF
It then kicks off FileOptimizerFull with an x number of instances in parallel.
@Nikkho, not sure if this is still on your list but I've since worked around the issue in my own application by calling the optimizers directly.
Sorry. I forgot about that issue. It was on my list, but did not take a look to it.
I tried to reproduce the problem systematically and this is not happening. It only happens sometimes and when you run serveral instances at once. It has nothing to do with that line, since this is only composing a text, not dividing.
The issue, I guess, is that FO is showing a MessageBox, and thus it will not be closed until de Messagebox is closed.
Can you try spawining the instances something like:
FileOptimizer64.exe /AllowMultipleInstances=true /BeepWhenDone=false image.png
To prevent that issue I have implemented that FO automatically disables BeepWhenDone when lauched via commandline: https://sourceforge.net/p/nikkhokkho/code/1687/
The command I'm currently using is quite long:
https://github.com/devedse/DeveImageOptimizer/blob/1f27f13edd45d7f102dc2a1097d1ef3c3a744aee/DeveImageOptimizer/ConstantsAndConfig.cs#L46
It includes these flags already:
So I don't think the cause is the /BeepWhenDone flag
Last edit: Devedse 2022-03-04
Hey I saw you closed this ticket. Is it resolved now?