G'MIC exercises

exercise

#64

discard: couldn’t remember what it was called! What does “-1=none (memory content)” mean? How does it differ from “0=none”?


(David Tschumperlé) #65

For command resize, argument interpolation means:

  • 0 (none) : does not interpolate the pixel data, just enlarge or cut image dimensions, but keep the meaning of the axes.
  • -1 (none, memory content) : does not interpolate the pixel data and does not keep the meaning of the axes. Just consider the pixel data as a linear buffer and resize it.
    Typical example:
$ gmic sp lena,512 +r[0] 256,256,1,3,0 +r[0] 256,256,1,3,-1

gives:

In the first case (interpolation=0), the image is just cut to half-size, in the second case (interpolation=-1), that’s the image buffer which is cut at the end.


#66

Thanks for the explanation but I won’t pretend to understand -1 :blush:. Maybe I will someday :sunny:.


New exercise: entropy. I thought about giving the calculation a try. I couldn’t find the IM formula, so I deferred to Matlab, which might be different…

gmic (0,1,2) histogram f (i/is)*log2(i/is) replace_nan -1 discard -1 s y + * -1
# (0,1,2) --> 1.58496
# sp tiger --> 7.36936

magick 012.png -format %[entropy] info:
# (0,1,2) --> 1
# tiger --> 0.948647

Nope.


From @Carmelo_DrRaw’s excellent PlayRaw:

high

I have not found a way to convincingly fill in these clipped highlights. I used PhotoFlow to remove the CA but there is still some remaining. I found a way to blur the CA and edges a bit to make the clipping less obvious. However, it would be nice to have the regions repaired.

a