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

Blur doesn't work #7

Open
tymscar opened this issue Sep 29, 2017 · 29 comments
Open

Blur doesn't work #7

tymscar opened this issue Sep 29, 2017 · 29 comments
Labels

Comments

@tymscar
Copy link

tymscar commented Sep 29, 2017

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.

@splintersuidman
Copy link
Owner

splintersuidman commented Sep 29, 2017

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
Copy link
Owner

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.

@tymscar
Copy link
Author

tymscar commented Sep 29, 2017

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

@splintersuidman
Copy link
Owner

Okay...

@splintersuidman
Copy link
Owner

Have you tried building from source?

@tymscar
Copy link
Author

tymscar commented Sep 29, 2017

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.

@splintersuidman
Copy link
Owner

splintersuidman commented Sep 29, 2017

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).

@tymscar
Copy link
Author

tymscar commented Sep 29, 2017

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

@tymscar
Copy link
Author

tymscar commented Oct 2, 2017

Any ideas?

@splintersuidman
Copy link
Owner

I have no idea...

@nihal127
Copy link

nihal127 commented Oct 9, 2017

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

@splintersuidman
Copy link
Owner

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.

@tymscar
Copy link
Author

tymscar commented Oct 9, 2017

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

@splintersuidman
Copy link
Owner

splintersuidman commented Oct 10, 2017

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.

@tymscar
Copy link
Author

tymscar commented Oct 12, 2017

How can I install it with with-loggin?

@splintersuidman
Copy link
Owner

splintersuidman commented Oct 12, 2017

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

@tymscar
Copy link
Author

tymscar commented Oct 12, 2017

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

@splintersuidman
Copy link
Owner

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

@tymscar
Copy link
Author

tymscar commented Oct 14, 2017

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

@slifin
Copy link

slifin commented Mar 20, 2018

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

@splintersuidman
Copy link
Owner

@slifin, what version of imagemagick do you have?

@slifin
Copy link

slifin commented Mar 20, 2018

screen shot 2018-03-20 at 13 36 48

@splintersuidman
Copy link
Owner

@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.

@ghost
Copy link

ghost commented Jul 3, 2018

Same here :S
Nothing from logs, tho

@splintersuidman
Copy link
Owner

splintersuidman commented Jul 7, 2018

@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 ...

@CedricRBR
Copy link

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.

@splintersuidman
Copy link
Owner

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.

@CedricRBR
Copy link

CedricRBR commented Jul 11, 2018

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.

@koekeishiya
Copy link

koekeishiya commented Aug 3, 2018

@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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants