Previewing in G'MIC

As this is just a new ā€˜customā€™ command of the stdlib added, you can just try

$ gmic -up

to make it available. The stdlib is downloaded from the Gā€™MIC website, and updated immediately.

1 Like

A parallel counterpart to -display0 would be awesome.

Also, I was wondering if there is a flexible way to output information. Currently, I use ImageMagickā€™s -format option, which is powerful, but sometimes I just want to use gmic by itself.

Good idea, Iā€™ll add it.

You can write something like this for instance:

$ gmic -v - -sp lena -echo_stdout \"Size : \"{w}x{h}\" \(\"{w*h}\" pixels\), with \"{s}\" channels.\"

which outputs (on the terminal):

Size : 512x512 (262144 pixels), with 3 channels.

But note that contrary to ImageMagick, Gā€™MIC doesnā€™t remember a lot of information about the images you are downloading: it ignores most of the metadata, the bit depth, etcā€¦, so depending on the information you want to print, IM may be more adapted. Anyway, the math expression evaluator in Gā€™MIC is extremely powerful, so if you want to display some calculation results from your images, it is likely thatā€™s a good tool to work with (see http://opensource.graphics/image-processing-made-easier-with-a-powerful-math-expression-evaluator/ for a quick tour of the Gā€™MIC evaluator).

1 Like

Nice. I will take a look.

While dp and dp0 are wonderful additions, I still find the original d and d0 commands useful. However, browsing can be awkward and tedious. E.g., take gmic sp tiger,dog,square:

  1. Going back to thumbnail view from single image view is clunky. Sometimes, I accidentally zoom in, and other times, the click doesnā€™t register because the mouse isnā€™t window active.

  2. It would be nice if I could simply proceed forward and backward through the list without going back out into the thumbnail view. A shortcut or GUI would be nice for quick browsing.

  3. It would be nice if the image aspect ratio were preserved regardless of the windowā€™s dimensions. This would be the default behavior that could be changed if user wanted.

  4. It would be nice if, in dp and dp0 mode, I could sync the zoom level between windows.

  5. Probably not for CLI, but I do miss the ability to toggle a preview in the plugin version. In the case of the CLI, it would be the ability to stack two images with the same dimensions and be able to toggle quickly between them. I guess this would be a more specific version of #2.

This is an interesting point. iā€™ll see what I can do for this.

I like to be able to change the ratio for specific images (e.g. 1xN vectors).
If you want to enlarge/reduce the window size, the convenient keyboard shortcuts CTRL+D, CTRL+C and CTRL+R are here.

What I do usually is stacking the images with append z , then use the mouse wheel to switch from one plane to another. This is a convenient way of comparing two or three images together.

Actually, one really cool thing would be to rewrite an image viewer directly as a Gā€™MIC command, put in the stdlib. This is possible, because Gā€™MIC is able to manage display windows and user events.
And we would then have the opportunity to improve the command without having to update/recompile the Gā€™MIC binaries.

1 Like

Thanks for exposing more to the stdlib. As with color conversions, I am unqualified to extend such commands; I will still have to depend on the efforts of others :baby_chick:.

Concerning display_graph, it would be nice if we could

  • Control the interval size of the axes.
  • Use the mouse to query graph values by placing the mouse on the graph, as opposed to getting image coordinates and values.
  • Be able to insert threshold lines; e.g., x = 1. That would be awesome.

This can be done using interactive command plot instead of display_graph.

Yes, probably. But for complex plot displays, GNUplot is probably a better choice :slight_smile:

1 Like

Silly me, I completely overlooked plot. Thanks.


Unfortunately, it doesnā€™t appear to work when zoomed in.

Actually, mouse wheel is already used in volumetric image to loop over the slices.
Maybe something like ALT+mouse instead.

I just tried plot. It would be nice if I could read the interpolated values along the line and that it would be in (x,y) format.

As long as I can alternate between 1-3 images quickly, :+1:.

There is another point to mention : I try to reduce the use of the keyboard because there is an option in command display that is exit_on_any_key which allows the user to basically catch keyboard events when displaying images.
ALT being a modifier, it is OK, but keep in mind that adding more and more keyboard shortcuts is not really desired if we donā€™t want to break this key event catcher ability.

1 Like

After some experiments, Alt is not great to use (at least on Linux), because it is already use by most WM to move/resize windows, so it is not possible to have Alt+mouse working for selecting multiple slices at once.
For now, Iā€™ve tried then CTRL+mouse to be able to alternatively select a region in a volumetric image (keeping all slices at once). Seems to work. Require mores testing obviously :slight_smile:

1 Like

So here is the solution Iā€™ve chosen, it seems to be quite practical, at least from the quick tests Iā€™ve done :

  • 2d images : zooming can be done with mouse wheel or mouse selection as before. When in zoomed mode, you can use SHIFT+wheel to move up/down, and CTRL+SHIFT+wheel to move left/right.

  • 3d images (volumetric) : mouse wheel is still use to loop over the slices/rows/columns as before. You can now zoom with mouse selection, CTRL + mouse selection or CTRL+mouse wheel.
    In the two latter cases, the zoom is performed in the space of the image quadrant you are on. So CTRL+wheel on the (x,y) part of the image will magnify only the (x,y) coordinates while keeping the z coordinate unchanged. See CTRL+ being a way to invoke an alternate zooming procedure.

So, now, to compare two images, it is quite easy to create a volumetric image, then use CTRL+ zoom mode to zoom in/out and then mouse wheel to compare the two images at the same zoom level.

PS : Iā€™ll post new 2.2.0_prerelease packages today with this addition.

1 Like

When viewing 3d images or using append z, is there supposed to be a two pixel column and row on the right and bottom edge of the window? It is especially apparent when zoomed in.

image

Yes, as you are displaying a 3d volumetric image, you see the views for (x,y), (x,z) and (y,z).

1 Like

It would be great if the display could also show the angle when making a rectangle with the mouse.

BTW, Gā€™MIC sometimes crashes when I make a rectangle soon after the display window opens. I cannot replicate this but I think it happens more often when I choose a direction other than :arrow_lower_right:.

Good idea, I see what I can do :slight_smile:

Interested to reproduce the crash if you can tell me a way to reproduce it always (tried here on Linux, with various selections, and no crash so far).

Unfortunately, sometimes is not always. :slight_smile: