The Big Bad G'MIC Thread of Silly Questions

I guess what you can do is to use scaled new image?

mmm this would slow things down i think?
Edit : and then i’d have to recalculate the position for ja? <I’m not even sure of this anyway, it could be shifted up automatically. mmm.
But I’d rather generate the tree at the right size.
Actually the tree height is not equal to the image size.
Tree height = 1 is really going out of the border (that’s fine, depends on what you want to see) :


Smaller trees in the front? no way :frowning:

Of course, if it was 3D, i wouldn’t have this maths headache… But i don’t think 3d planes can use alpha textures ( it’s black).

If you are going for realism, then larger trees are surrounded by less trees. Other brush are sparsely placed, but could be more abundant at the edges of the lot. Front row does not have to be shorter than back row, since trees tend to vary in height anyway.

Good to know. Not sure i’d go that far. I wouldn’t know how to do that anyway.

But i want to add a little bit of depth.

I actuially want them to be taller in the front row, and smaller in the back, to simulate perspective and depth. ( and yes, i use varying sizes)

I edited the post a slightly while you were replying.

Oh, as a bonus, maybe have an Easter egg, e.g., a little rabbit somewhere (reference intended). :wink:

PS - these posts should probably be in the filter’s thread.

yes, i thought about that. A random encounter that appears every now and then.
A rabbit, or Sadako, i don’t know. Both can kill you in seconds, i guess.

Nah, who cares about this. The filter’s thread is for fun or updates, not for headaches.

BTW, is there an expand equivalent to autocrop? To autoexpand?

Alright, tried this and it didn’t go so well.
it doesn’t work since the tress are shifted in position, sp they m ay be cut in half and moved to the sides, so scaling the images will just show ugly clipping.

Even for one or a few files, set them up in a git repository (git init; git add --all; git commit -m "Here begins recorded history.") and commit often with a brief, synopsis messages addressed to your future self (Don’t do “.” synopses! Your future self will thank you) . Every commit is a snapshot. git log replays your synopses, along with commit hashes. git diff <hash>.. <subsequent hash> displays ± differences between the two commits. the hashes need not be adjacent and may be abbreviated to the first four to eight characters — you only need to write enough of hashes to establish uniqueness. If you discover that your line of effort is turning out fruitless, then:

$ git branch newidea df5ccdf6  # <-- hash of last 'sane' commit. Could be from a few days ago...
$ git switch newidea
Switched to branch 'newidea'

sends you back in time to when you were still sane, to a branch point that you’ve just named newidea. All your fruitless edits revert — disappear from your workspace, though they are still on the branch you have departed (let’s say that branch is named mainline.) Having branched off of mainline to newidea you can develop along an alternate scheme. You can always switch back to mainline if newidea doesn’t work out. Or start off other branches elsewhere. Every wild-eyed experiment can go on its own branch, and you can switch to it anytime from anywhere else in your project. See the SCM manual.

There is no sane reason not to learn this basic, effective tool — especially now that your work is becoming non-trivial. The ability to backtrack-and-retrack is immeasurably valuable. Don’t put it off to this weekend or when you’re “no so busy.” Do it now.

Thanks for the tip. I just feel like i have a ton of stuff to learn, don’t know where to start, (don’t know why either), and have lost all my patience a long time ago.

I usually just duplicate a line, comment the old one and modify the new one, in place. It’s just when i have to use maths, my mind goes blank, and i don’t really know what to use to do what i want to do.

Still haven’t found a solution for the height problem, but then yesterday it took me just 2 minutes to write this idea :
{floor($treeComp^($T/$R))}
$T is just $>+1, $R number of loops, $treeComp being complexity.
Results below.

Test
gmic run 'repeat 45 { echo {floor(15^((1+$>)/45))} }' 
[gmic]./ Start G'MIC interpreter (v.3.3.6).
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
3
3
3
3
3
4
4
4
5
5
5
6
6
6
7
7
8
8
9
9
10
11
11
12
13
14
15
[gmic]./ End G'MIC interpreter.


Ugly? Yes. What am i doing? Don’t know. It works though.

Which gives me a LOD effect : Trees in the back are less detailed than the front.
And i have no idea how i came up with this, really. It just happened. There’s probably too many parenthesis though. :sweat_smile:
What i mean is, when i want to, i can’t, and when i just do stuff without thinking, it works. And now i don’t know how to adjust this so it doesn’t start too low… sigh.
At least it’s useful when tere are a lot of trees, saves some time ( can’t really reuse trees with current code). Anyway, will make it optional, as usual.

1 Like

Is this normal ?

When i run this in my terminal :

 gmic sp tiger,lena,david store 1,img input $img
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Input sample image 'tiger' (1 image 750x500x1x3).
[gmic]./ Input sample image 'lena' (1 image 512x512x1x3).
[gmic]./ Input sample image 'david' (1 image 800x600x1x3).
[gmic]./ Store images [0,1,2] as compressedvariable 'img'
[gmic]./ Input file '' at position 0
[gmic]./ *** Error *** Command 'input': Unknown filename ''.

Tried this as a last resort and it works :
gmic run 'sp tiger,lena,david store 1,img $img'

EDIT: i guess it is normal, since this does not work either :

gmic x=test echo $x
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Set local variable 'x=test'.

[gmic]./ End G'MIC interpreter.

OK found out i have to use quotes or {} in the terminal:
gmic sp tiger,lena,david store 1,img '$img'

gmic x=test echo '$x'
[gmic]./ Start G'MIC interpreter (v.3.3.6).
[gmic]./ Set local variable 'x=test'.
test
[gmic]./ End G'MIC interpreter.

Your second example would work in Windows CMD. Terminal rules are very strict, man. That’s pretty much all I have to say, and with emphasis on man in figure of speech kind of thing.

Yes, that’s because your shell (bash probably) also uses the $ character to perform its own variable substitution, so $x will be substituted by bash by `` (empty string), before the whole command is passed to the G’MIC interpreter.

Yes, realised that a bit too late after posting so I debugged myself.
My bad for never using vars in the shell.
Thanks

1 Like

See Riffs
Sometimes, even the pipeline argument given to run undergoes transformation by the superior (outer) shell. Seems the safest approach to shielding G’MIC commands is to manually create a custom command (foo: …) and put your experimental pipeline in there. run strives to do such automatically, turning its argument into a custom command. Alas, from time to time, some shells still strive to transform $ expressions, even those embedded in single-quoted argument strings, before hand-off to G’MIC. Since such $ expressions are likely to be undefined to the outer shell, these are substituted by that outer shell with empty strings and the G’MIC run command obtains arguments that have been partially erased. This is a perennial problem. See also this June, 2023 discussion from G’MIC Tutorial Fragments, Post #122.

Didn’t know that run had some bash substitutions going on too. I guess I’ll create .gmic files from now on.

Btw, is there a terminal or software that doesn’t write to .bash_history? I only see gmic in there now.

Edit: forget it, I just saw that commands preceded by a space are not saved with this var:
HISTCONTROL="ignoredups:ignorespace"
Good to know!

Duplicate:input does not delete, drain or otherwise change storage variables. Storage variables may be used to restore their related images any number of times.

How do you delete stored images when you don’t need them anymore? Reassign the var to an empty string? What is the proper way to remove them?

Yes x10.

You’re using store?

Will probably do, yes. Why?