8 ms·
How to use math input in GIMP
- adrift 6y agoThat's actually a neat idea.
- thdrdt 6y agoI believe there is a lot of software that can do math on input. Holding and moving up/down to increase or decrease is also supported in a lot of software.
- the_pwner224 6y agoMost spinboxes also let you use the scrollwheel on them.
- boogies 6y agoThat seems to work for all GTK+ spinboxes. I wish math input was built into GTK+ and worked for them all too.
- altern8 6y agoFor GIMP, it's a miracle.
- flobosg 6y agoSeveral programs support this, including Inkscape.
- etskinner 6y agoWould love it if more software and websites did this. Banking, online stores, etc. could benefit a lot. Even some CAD software doesn't have this functionality. In YNAB, it's essential, so I'm glad they have it.
- grawprog 6y agoThe first program I used with math on input was alphacam, it was mind blowing to me when I discovered it. Any time I use a program with out it now it feels lacking. The Godot editor has this feature too, just to drop another great piece of open source software with it.
- narrowtux 6y agoIf you want a feature like this in elixir, I've made a library for that: https://github.com/narrowtux/abacus https://github.com/narrowtux/abacus
- ggambetta 6y ago> GIMP even respects the order of operations, so if you go for something like 600 - 2 * 5, the answer will be 590. I mean, what else could it do? That this needs to be said makes me strangely sad :(
- altern8 6y agoLeft to right..?
- kevin_thibedeau 6y agoMany older languages evaluated expressions left to right. For assemblers this saves you from managing intermediate values and you can spit out ALU instructions in order without need for register assignment magic.
- bobbiechen 6y agoVisiCalc [1], the first spreadsheet program and the "killer app" for business on the Apple II, also used left-to-right evaluation. Dan Bricklin said he needed people to be able to quickly enter equations as they did on a cheap (non-RPN) calculator [2, at around 35:10]. [1] https://en.wikipedia.org/wiki/VisiCalc https://en.wikipedia.org/wiki/VisiCalc [2] https://scs.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=d129250d-7c28-45f5-874b-a9fa01542afb https://scs.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=...
- ggambetta 6y agoThat's not the tone in this article, though. It's not "the input field is not in RPN", it's "OMG CAN DO THE BASICEST OF BASIC MATH, HOW CLEVER!!!"
- yjftsjthsd-h 6y agoObvious thought: reverse Polish notation. It'd be a little surprising from GIMP, but not unthinkable.
- bbotond 6y agoIt needs to be said because not every user is a programmer and things like this aren’t obvious to them.
- ncmncm 6y agoPretty handy, particularly ratios. I was hoping I would learn that you could do parametric formulas to define curves, and maybe even Taylor series for curves too hard to define in closed form. Someday.
- btrettel 6y agoAfter some trial and error, I was able to make the following bash script, which will take the X clipboard selection (containing math operations you want to perform), run it through bc (to do the math), replace the X clipboard with the result, and paste it, overwriting the previous result: output=$(echo "$(xclip -o)" | bc) # take the X clipboard and run it through bc sleep 0.2s # wait before continuing or else this won't work xdotool key BackSpace # clear the selection printf $output | xclip -i # write the output to the X clipboard xdotool click 2 # paste the result by clicking the middle button I set this as Super-E on my computer and probably will use it every once in a while for programs which don't implement math input. In other words, with this you can select text containing mathematical operations, press a key combination, and the selected text will be replaced by the result of the math. Improvements welcome. There probably are better ways to do this.
- btrettel 6y agoOne disadvantage of this approach is that the mouse needs to be over the text area that's being pasted in to.