blur icon indicating copy to clipboard operation
blur copied to clipboard

Blur doesn't work

Open tymscar opened this issue 7 years ago • 29 comments

Hello.

I downloaded the blur.so and followed the instructions. It doesn't do anything. I checked the /tmp/ folder and it does indeed create a "blurred" file there but that file is IDENTICAL with my wallpaper. No blur is applied to it. I did however try changing the blur strength as suggested and it did nothing. Set it up as high as 50.

tymscar avatar Sep 29 '17 00:09 tymscar

Hi,

I think the problem you're facing is a problem with imagemagick. ~~You might have to install it: brew install imagemagick.~~

If that does not fix it, I don't know what the problem might be.

Do you have the same issue with all pictures?

splintersuidman avatar Sep 29 '17 06:09 splintersuidman

The code in blurwallpaper.c is using imagemagick to blur an image. Most of it works for you, only the blur does not work. Could you send me you wallpaper, so I can see if it works for me? I will search imagemagicks API for different blur methods.

splintersuidman avatar Sep 29 '17 08:09 splintersuidman

The wallpaper is not the issue. I tried with 10+ wallpapers and its the same problem

tymscar avatar Sep 29 '17 08:09 tymscar

Okay...

splintersuidman avatar Sep 29 '17 08:09 splintersuidman

Have you tried building from source?

splintersuidman avatar Sep 29 '17 09:09 splintersuidman

Yes. Still the same. I did however "make it work". Have a wallpaper set. Restart the chunkwm service. Go to /tmp/ and blur manually the wallpaper, reset the same wallpaper(original one, not the blurred one). Because its tge same one, it wont make a new version in /tmp/ and it will use my blurred one. Tadaaa: now it works.

It still is nowhere near automatical but its a step in the right direction.

tymscar avatar Sep 29 '17 09:09 tymscar

Could you download blur-test.zip, unzip it, and run make in the unzipped folder? Then use ./blur-test [input] [output] [intensity].

This file is the part of the plugin that I suspect does not work for you. It should write the blurred [input] to [output]. It works for me. If it does not work for you, the problem might be a problem with imagemagick, or a problem with your images (I doubt it's the latter).

splintersuidman avatar Sep 29 '17 09:09 splintersuidman

It did work. 🤔 screen shot 2017-09-29 at 17 33 39

tymscar avatar Sep 29 '17 16:09 tymscar

Any ideas?

tymscar avatar Oct 02 '17 00:10 tymscar

I have no idea...

splintersuidman avatar Oct 02 '17 17:10 splintersuidman

i tried the above blur-test.zip and the blur worked perfectly but originally no file was created in /tmp/

nihal127 avatar Oct 09 '17 08:10 nihal127

Version 0.1.4 improves the error messages. Could you look what error is printed in /usr/local/var/log/chunkwm/chunkwm.err.log? I think that file is the standard error log for the homebrew installation.

splintersuidman avatar Oct 09 '17 18:10 splintersuidman

Its even worse now :( I downloaded the new .so and it didn't work. Then I built it myself. Still nothing. It doesn't even write anything to /tmp/ and the log file you said its not there.

screen shot 2017-10-09 at 22 53 26

tymscar avatar Oct 09 '17 21:10 tymscar

Then I might have an idea what the problem may be. The code exits with failure before writing the file in v0.1.4. Look at the following code

Status = MagickBlurImage(Wand, Range, Sigma);
if (Status == MagickFalse)
{
    fprintf(stderr, "blur: could not blur image\n");
    return 2;
}

Status = MagickWriteImage(Wand, Output);
if (Status == MagickFalse)
{
    fprintf(stderr, "blur: could not write image\n");
    return 3;
}

The MagickBlurImage tries to blur the image, and if that fails it returns before writing the file. That’s the part that’s failing. And for @nihal127 I think the file writing may be the issue.

For logging to the file I asked you to check, you need to have installed chunkwm with the option with-logging.

splintersuidman avatar Oct 10 '17 05:10 splintersuidman

How can I install it with with-loggin?

tymscar avatar Oct 12 '17 02:10 tymscar

brew install chunkwm --with-logging, after you’ve unlinked: brew unlink chunkwm.

splintersuidman avatar Oct 12 '17 05:10 splintersuidman

Ok. I actually got some logs this time. Most were unrelated tiling logs but one of the said: blur: could not find image

tymscar avatar Oct 12 '17 09:10 tymscar

Then it’s a problem with MagickReadImage. Have you set your wallpaper in your .chunkwmrc?

splintersuidman avatar Oct 14 '17 20:10 splintersuidman

Yes I did. I even ran the command in the terminal to set it

tymscar avatar Oct 14 '17 20:10 tymscar

I had the same issue as this, uninstalled the plugin for now, but I found an unmodified picture in /tmp of my current wallpaper

slifin avatar Mar 20 '18 10:03 slifin

@slifin, what version of imagemagick do you have?

splintersuidman avatar Mar 20 '18 12:03 splintersuidman

screen shot 2018-03-20 at 13 36 48

slifin avatar Mar 20 '18 13:03 slifin

@slifin, can you find anything in the log? You can use chunkc core::log_file <file> to redirect the errors to a file (with chunkc core::log_level error [minimum: error]). To find anything related to this plugin, you can use stdout as log file, and run chunkwm | grep blur.

splintersuidman avatar Mar 20 '18 14:03 splintersuidman

Same here :S Nothing from logs, tho

ghost avatar Jul 03 '18 16:07 ghost

@chicocode, could you run the following commands and look whether there are any differences with my output (the text between [] is not actual output):

$ chunkwm --version
chunkwm 0.4.3
$ magick --version
Version: ImageMagick 7.0.8-3 Q16 x86_64 2018-06-25 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules 
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
$ chunkwm | grep blur
PluginName 'blur'
2018-07-07 18:23:54 DEBUG: chunkwm: plugin 'blur.so' loaded!
2018-07-07 18:23:54 DEBUG: Plugin 'blur' subscribed to 'chunkwm_export_application_terminated'
[ ... subscriptions ... ]

I still have no clue what might cause this issue ...

splintersuidman avatar Jul 07 '18 16:07 splintersuidman

Hello, same issue here: ERROR: blur: could not find image and an unmodified image in /tmp/. Using the zip provided did work but took about 45 seconds (was a 9000 × 5063 picture after all).

I have both set the wallpaper in .chunkwmrc and manually set it with the runtime command.

chunkwm --version and magick --version give the same result as yours, the grep logically returns the errors, all of type could not find image.

CedricRBR avatar Jul 10 '18 19:07 CedricRBR

I think one of the causes of this issue is the time it takes ImageMagick to blur the image. The blurring happens in the same thread chunkwm runs, and essentially blocks it at startup. (I think plugins don't run in different threads, but I'm not sure.) If blurring takes 45 seconds, the startup of other plugins is probably delayed that same time. @CedricRBR, do other plugins (e.g. tiling or border) run when you're using this plugin?

I'm going to add some more debugging logging, and I think I might have to redesign parts of the plugin.

splintersuidman avatar Jul 11 '18 11:07 splintersuidman

My load order is the following:

  1. border
  2. tiling
  3. ffm
  4. blur

And for the first ~45 seconds border and tiling do indeed not work, but ffm does. Once the other plugins started working I checked /tmp/ and there was an unblurred copy.

I then stopped chunkwm and changed to a smaller image, which gave me the same result. Then I set the blur to a fixed value of 25 and got a blurred image in /tmp/ but enabling/disabling blur didn't do anything. Weirdly enough I have no error in the log: 2018-07-11 16:03:57 DEBUG: chunkwm: processing event of type 'ChunkWM_PluginBroadcast' 2018-07-11 16:03:57 DEBUG: chunkwm: processing event of type 'ChunkWM_PluginBroadcast' 2018-07-11 16:04:05 DEBUG: chunkwm: processing event of type 'ChunkWM_PluginCommand' 2018-07-11 16:04:05 DEBUG: blur: disabling. 2018-07-11 16:04:11 DEBUG: chunkwm: processing event of type 'ChunkWM_PluginCommand' 2018-07-11 16:04:11 DEBUG: blur: enabling.

CedricRBR avatar Jul 11 '18 14:07 CedricRBR

@splintah

Just filling in some info here regarding the plugin system.

So plugins in chunkwm does not run on their separate thread, but we process multiple plugins simultaneously. There is basically a single event queue, and this event queue is serialized, meaning all plugins have to finish processing the current event before any of the plugins are allowed to continue on to the next event, but multiple plugins can process the same event at the same time.

The reason for this design is such that we know that the context (event data) is valid until ALL plugins have finished handling the event. This allows us to NOT have to duplicate the event data (and event list) for every single plugin.

I could change the system so that each plugin has their own event-queue, and references an event in the main queue. When all plugins have finished processing the event, it is removed from the main queue and THEN we can free the context. This would allow plugins to run in a separate thread completely.

For tihs specific instance, you could just have your plugin spawn a thread that blurs the image and sets the wallpaper.

End of rambling..

koekeishiya avatar Aug 03 '18 13:08 koekeishiya