I believe there is a problem with how gmic is handling the new non-destructive cropping feature. When I make a selection and apply a gmic filter to the selection on a canvas that has been cropped, the canvas moves underneath the selection.
To recreate…
Crop an image
Make a selection
Apply a gmic filter
I’ve also attached a small video showing the steps. I apologize if this is not a gmic issue, but this isn’t happening on the few stock gimp filters I’ve tried.
The video was helpful. Unfortunately, I can’t reproduce your issue. The only time I have a problem is when G’MIC changes the dimensions of the input image. Sharpen (inverse diffusion) doesn’t do that.
Which versions of GIMP and G’MIC are you using and have you updated your filters?
Thanks for reporting this @akovia.
The non-destructive crop feature is indeed new in GIMP, and I suspect we have to manage it in the plug-in as well.
as it’s quite hard to find up-to-date documentation about this feature in the GIMP plug-in API, I doubt we can fix this easily, but maybe one of the GIMP developer could help
(@Jehan ?).
The “non destructive cropping” basically only allows redimensionning the canvas with the Crop tool. It doesn’t do anything particularly new and these were things which were already possible before (it just used to be a bit more cumbersome and less visual; the Crop tool changes allows on-canvas preview of the old canvas size feature basically).
I am guessing the issue which you encounter could also happen if you were to redimension the canvas with Image > Canvas Size… option or just if you moved the layer (with the Move tool) into a negative offset.
Basically my guess is that G’Mic is repositionning the layer after the filter with offset 0. If G’Mic needs to do anything relative to layer position, it should check its offsets first with gimp_drawable_offsets() and do appropriate computation to decide what are the right offsets afterwards. Offsets can be positive or negative. We cannot assume anything there.
just to be able to ‘update’ the modified layer on the GIMP view (which is an ugly way of doing it indeed).
Without that, we can see that the layer has been modified, because of the layer preview in the Layer dialog, but the real view is not updated.
We haven’t found any other solution. I’ve tried other things as gimp_drawable_flush, gimp_display_flush and the merge_shadow stuffs, but nothing is working.
Do you have an idea ?
I am guessing you are modifying directly the GeglBuffer associated with a drawable, aren’t you? The sync with the drawable is “lazy”, it doesn’t happen with just a modification. You need to g_object_unref() it, which forces its content to be synced back into the drawable.
Alternatively, for instance if you want to refresh the drawable render but are not done with the buffer (you want to continue modifying it), you can gegl_buffer_flush() it instead. Then you keep the buffer reference and still get it to be displayed properly in the canvas.