Started a new interactive visualization command

(G'MIC staff) #1

Hello there,
I just wanted to let you know I’ve started working on a new G’MIC command display2d (shortcut d2d), intended to offer an alternative viewer for 2d images.
The cool thing with having such a viewer defined as a custom command is the fact I’ll be able to customize it more easily, and re-use its code for other interactive commands if needed.

If you have G’MIC 2.6.2_pre compiled somewhere (CLI tool), then you should be able to test it already, with $ gmic sp car d2d.

Right now, the command does not do much than the native display command, except that:

  • Image pan is now supported with the middle mouse button.
  • Image zooming in/out, with the mouse wheel (or keys +/- of the numeric pad).
  • Local image normalization can be enabled/disabled, with key N.

I plan to add some more features, such as the ability to display 4-channels images are RGBA.
I’ll probably allow the user to select a crop also in the d2d command.

Just let me know what you think about it, if you have a way to test it.

(Karsten R) #2

Looks good.
Zooming with mouse does zoom and some pan! It’s seemingly not possible to reduce image size below initial size?

N switches normalization but with a second N.

What about more images in the window? (gmic osteo_ d2d)

(G'MIC staff) #3

I’ve made some progress on command display2d:

  • Added ‘notifications’ to show what is happening when pressing a combination of keys.

  • So far, recognized key combinations are:

    • CTRL + A : Enable/Disable Alpha mode. (default: off)
      Alpha mode enabled allows to view the transparency for GREYA or RGBA input images.
    • CTRL + Z: Enable/Disable Preservation of Aspect Ratio (default:on)
      This mode influences the way the image is displayed when the display window is resized. The aspect ratio of the input image can be preserved, or not.
    • CTRL + N: Enable/Disable Value Normalization (default:on).
      Three normalization modes are available : disabled, enabled or channel by channel. Normalization is not applied on the alpha channel when Alpha mode is enabled.
    • CTRL + O: Save a copy of the input image, as a numbered .gmz file.
    • CTRL + S: Save a copy of the current view, as a numbered .png file (aka screenshot).
    • CTRL + SPACE: Re-center and resize image to fit display window.
    • CTRL + R: Reset view and window size.
    • CTRL + D: Increase window size.
    • CTRL + C: Decrease window size.

To move and zoom image in/out, the following ways are supported:

  • Mouse wheel or PAD+,PAD- : Zoom in/out.
  • Middle mouse button or CTRL + Left mouse button : Move image.
  • Arrow keys : Move image.

As I said before, the code of this command is intended to be re-used afterwards in other interactive commands, as a solid basis to start with, allowing an easy navigation in the image content, with a common set of key shortcuts. I’ll try then to make it as clean as possible.
So, do not hesitate to test and give feedback!

Multiple image views can be done with a combination of display2d and parallel, just like this:

$ gmic sample duck,car parallel d2d[0],d2d[1]
(Karsten R) #4

Nice Progress!

There is an error displaying a gray scale image with share

gmic sp 0 sp 1 luminance parallel d2d…,d2d.

1 Like
(G'MIC staff) #5

Thats has been fixed.
Also fixed the shift when zooming in/out repeatedly.
This is looking quite good now!