WIP: Unified Image VIewer for G'MIC

Hey folks,

I’d like to talk about one project I’ve started a few days ago: re-implementing an interactive image viewer for G’MIC, intended to become the default one used in the future.
My main goals with this viewer are:

  • Unified viewer: one single viewer (so one single command) to cover all the cases: 2D/3D images, 3D meshes and image lists. Currently, we have different commands for viewing 2D images (display2d), 3D images (display, native command) and meshes (display3d). The idea here is to be able to open a single interface on which we stay to view all these kind of data (image selection).

  • Adaptive to the window size: One of the key property is to make the viewer adaptable to the opened display window. So even if the window size change, the content stay coherent.

I’ve pushed a first draft of this viewer in the gmic-community repository (command ndisplay, shortcut: nd). Beware, this is highly WIP!!. Clearly of no interest to the average G’MIC user! Most of the planed features are missing.

You can test it for instance like this (after a gmic update):

$ gmic repeat 30 { sp } nd

For now, it has only the basic feature of browsing a list of 2D images. so far, I’ve only focused on the navigation feature to select one specific image of an image list.
But the basis is here, and I hope to have time to implement the desired features (even at a slow pace :slight_smile: ).

So, if you want to test and tell me if that also works for you, please let me know.
Feedback appreciated (no feature requests at this point, please, I’ve already plenty in my mind).

As I said, I’d like to make this the default viewer in G’MIC in future releases, so it’s better to have something well tested before making the switch.

Thanks for your time!


I would like to know the value of pixels with different color space. It looks good, and already is better in some way.

I don’t I have will have the time to explore this. Here are some thoughts:

I know that G’MIC is colour space unaware (internally and colour management wise), but yeah, it would be cool if it were more aware. Also, being more consistent under various zooms or crops would be a boon. Currently, it is an all or nothing normalization type of mode. Hopefully, the pixel stretching, and weird window placement, in Windows OS is gone.

1 Like

Regarding pixel stretching, there are use case for that. It makes navigating dynamic array or reference values image easier. But, I don’t think it’s that needed.

I meant a way to control that behaviour. As an image viewer, at least for me, it is unexpected, even though I have been using G’MIC for a long time. Kind of having a mark on a clean white t-shirt or canvas: cannot help but be bothered by it.

Hmm. In that case, I thought about it. A default zoom level and uniform zooming depending on minimal dimension size. Then, having a scroll bar. This way, you can navigate regular images, and dynamic array quite easily. I don’t think the current window support in G’MIC allows for native window and scroll bar. That would enable a lot more things. Maybe that’s a little too much on top of subwindows inside window.

Hello, I guess I’m missing something?

paul@graveyron:~$ gmic update
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Update commands from the latest definition file on the G'MIC server.
[gmic]-0./ End G'MIC interpreter.
paul@graveyron:~$ gmic repeat 30 { sp } nd
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./*repeat/ Input file '{' at position 0
[gmic]-0./*repeat/ *** Error *** Unknown command or filename '{'; did you mean '%'?

This works only for G’MIC 3.2.0+. I suspect you have an older version ?

You’re right, I’m on v2.9.4.

Makes me wonder why I don’t have the latest gmic after the ‘gmic update’ command…

Because the command update only updates the set of G’MIC filters and stdlib commands, not the G’MIC interpreter itself (which is a binary blob that must be recompiled, so it requires a new software installation).

That’s clear, thanks.

@David_Tschumperle would it be a good idea to insert G’mic version at the end of this line? Like:

Start G'MIC interpreter v3.2.7

This could avoid asking a lot of questions for debugging I think.

This is already done when debug option is activated, but yes, doing this even in normal mode would be a good idea.

What is nd? I would have expected a done.

a temporary name for ndisplay (new display).

1 Like
1 Like

done is actually the same as }.

Ha ha. I forgot! Still haven’t been using modern G’MIC due to time and my ailing machine. I am sure it will blow my socks off. :wind_face::socks:

Progress report:

  • I’ve done lot of code since yesterday, and I think I’m almost done with the image selection part. Now I’ll try to manage the interactions in the “image” (lower) part of the viewer, with the implementation of the pan/zoom for 2D and 3D (volumetric) images.

  • I’ve found out that managing correctly all the variety of images allowed in G’MIC is quite challenging. G’MIC images are float-valued, so pixels can be +-inf and NaN values, which does not normalize very well. Also, G’MIC images can be of any size, having an arbitrary number of channels, etc. Even implementing a simple thing as “create a RGB thumbnail of this image” becomes quite challenging.

  • I’ve pushed the updated implementation of command ndisplay in the update, so $ gmic update should work (if you use G’MIC v.3.2.0+).

  • A viewer with a “navigation toolbar” allowing to browse the images in the image list seems also to be quite convenient for doing image comparison (for instance, when working on denoising algorithms). It’ll finally save me the hassle of stacking my images along the z-axis to compare them, as I used to do before.

1 Like

Nice progress. Perhaps to limit the scolling bar with the last image on the right side, not on the left.