GNOME Bugzilla – Bug 557380
Filter 'Edge Detect/Difference of Gaussians' returns empty image
Last modified: 2016-10-11 14:47:56 UTC
Please describe the problem: If difference of gaussians edge-detect is used on an image/layer with alpha and the "Invert" option is selected, the result in both preview and final image is fully transparent no matter the original image, or the other DOG settings. If DOG is used on a non-alpha image, the preview goes completely black, but the actual image results in an edged picture. Steps to reproduce: 1. Create a new RGB image. 2. In Layers, Add Alpha Channel 3. Choose any brush and paint some squiggles in the image. 4. Select Filters -> Edge Detect -> Difference of Gaussians 5. Ensure the "Invert" image is selected. Alternatively, do all the steps above, excepting step 2. Actual results: On an RGBA image, just get a transparent image. The RGB channels are blank white if the alpha channel is removed. On a RGB image, just get a black image. Expected results: Some colour and value information in RGB channels, and background either white/grey or transparent. Does this happen every time? Yes. Other information: This version of gimp was built and installed off an Ubuntu Intrepid source file, on a Hardy Heron system. If required, I will rebuild from the gimp source and check.
Confirming. For images with no alpha channel, this does result in an all-black layer.
Update. Gimp 2.6.4 on windows correctly applies DOG to a non-alpha channel image, but still shows black in the preview. Not tested with an alpha-image or 2.6.4 on Linux yet.
*** Bug 572072 has been marked as a duplicate of this bug. ***
*** Bug 575659 has been marked as a duplicate of this bug. ***
Created attachment 138026 [details] [review] Quick hack to restore the preview when invert is selected The attached patch is a quick and dirty hack to restore the preview when invert is selected. The problem is that calling 'gimp_invert' has the side effect to free the shadow tiles associated to the drawable it receives. Patch against 'plug-ins/common/edge-dog.c' - release 2.6.6
That is dirty indeed, the GimpPixelRgn struct should be considered read-only. I wonder if it would be better if edge-dog.c would just implement invert itself?
This hack will be the first of its kind, no other piece of code does this elsewhere in the hole GIMP source tree. I think this hack is too risky for 2.6 and that we should look for a proper fix instead. Maybe introducing and using a new GimpPixelRgn? Or as Sven suggests, implement invert locally in edge-dog.c. Whatever is works best and is the most convenient. It should be noted that GEGL already has a "gegl:difference-of-gaussians" operation. In other words, we don't have to take future reuse of this code into account.
Created attachment 164698 [details] [review] implement invert in the plug-in to get around gimp_invert shadow issues Fixes the preview issue which is the subject of the bug. Implement invert in the plug-in, inside the (now renamed) normalize routine so we're not needlessly iterating twice in the usual case. It is potentially slower if normalize is off, since an extra multiplication by 1 is done on each pixel in that case, but I think its normally run with "normalize" and I think its a decent tradeoff.
Review of attachment 164698 [details] [review]: Looks good to me. A patch created from a git commit using git-format-patch would be even better though...
*** Bug 626303 has been marked as a duplicate of this bug. ***
Committed to master and gimp-2-6 branches commit 90eda12905273aa1ab0b53bcf3898e2a61037367 Author: Seth Burgess <sjburges@gimp.org> Date: Mon Sep 13 02:08:05 2010 +0200 plug-ins: Fix preview in Difference of Gaussians Implement invert as part of normalize routine - See Bug 557380
*** Bug 681817 has been marked as a duplicate of this bug. ***
The same is again with GIMP 2.8.2 on Win and Mac. As the reporter of bug #681817 stated: The respective GEGL operation works, so he's not sure whether this is still worth fixing.
I ran into this on GIMP 2.8.2 on Ubuntu 12.10 What I noticed is that the PREVIEW looks good - but the preview result is not copied (written) into the image. Here is an example (pre/post) http://ubuntuone.com/7j8j1V7bEz0XIo8TVKlexF James
*** Bug 749786 has been marked as a duplicate of this bug. ***
This seems to have been fixed with the change to replace the edge detect plugin with the GEGL edge ops (573f0f69bbad6c06b18fd90c833132034912e423 in gimp master).
This is about the Difference of Gaussians plug-in, not the Edge plug-in.
Created attachment 313149 [details] [review] fix edge-dog for layer with alpha channel Copy the original alpha channel to the shadow buffer during pixels difference computation. Is this the expected plug-in result ? Anyway, it is better than the current result...
Confirmed on ubuntu 15.10 with gimp 2.8. The resulting image is totally erased (transparent), whereas the preview is ok.
(In reply to gquentin from comment #19) > Confirmed on ubuntu 15.10 with gimp 2.8. > > The resulting image is totally erased (transparent), whereas the preview is > ok. The GEGL tool, DOG, works correctly.
Let's see if we can fix this for 2.8, too.
See the issue on Windows 10 w/ v 2.8.16. Wondering if a fix will be forthcoming and in which release. Thanks.
The question to answer would be whether the patch attached with comment 18 produces the expected result.
I asked because after comment 18 there were several other posts that said they still had the problem, along with a comment "Let's see if we can fix this for 2.8 too.", which led me to believe that the fix was only for 2.6. Even if I had figured that out, I have no idea how to apply the patch attached with comment 18. I happen to be a user, not a developer. Can you throw me a bone here?
Thomas, can you just apply the patch if it makes things better?
The most recent patch introduces a new translatable string. + g_message (_("Region affected by plug-in is empty")); We are currently in a string freeze for gimp-2-8. Unless this message is identical to an already translated message, it can't go in until after the freeze and release of 2.8.20. https://wiki.gnome.org/TranslationProject/HandlingStringFreezes
(In reply to Michael Schumacher from comment #26) > The most recent patch introduces a new translatable string. > > + g_message (_("Region affected by plug-in is empty")); > > We are currently in a string freeze for gimp-2-8. Unless this message is > identical to an already translated message, it can't go in until after the > freeze and release of 2.8.20. > > https://wiki.gnome.org/TranslationProject/HandlingStringFreezes "Region affected by plug-in is empty" is an already translated string, found on iwarp and whirl-pinch plug-ins.
Pushed to gimp-2-8 commit 27604f579cec54ef80bcb9a08aff2c699e850e9c Author: Thomas Manni <thomas.manni@free.fr> Date: Tue Oct 11 16:26:59 2016 +0200 Bug 557380 - Filter 'Edge Detect/Difference of Gaussians' returns empty image Copy the original alpha channel (if exists) to the shadow buffer during pixels difference computation. plug-ins/common/edge-dog.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 52 insertions(+), 33 deletions(-)