Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 18 Dec 2017, 03:20
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Engineering/Science/Simulation
measur3r v1.3 - onscreen measurement in pixels, cm, inches
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
SFR


Joined: 26 Oct 2011
Posts: 1647

PostPosted: Tue 03 Mar 2015, 11:40    Post subject:  measur3r v1.3 - onscreen measurement in pixels, cm, inches  

With this app you can measure objects on the desktop.
Just launch it, click on point A, click on point B and enjoy the results. Wink
You'll get coordinates of A & B points, a distance between them in pixels, centimeters and inches, and additionally a distance relative to X and Y axes.

Requirements: bash, xwininfo, xrandr, getcurpos, awk, which (g)xmessage

EDIT: attached also measur3r_lite, which supports only pixel units, not cm/in.
For those for whom the regular version can not read the physical display size and who are unable to determine that size by themselves (or just don't need/care about cm/in).
___________

Changelog:

Version 1.1
- a warning window in case if obtaining the physical size of the display has failed (thanks to Jasper & mister_electronico)
- physical size of the display can be also defined manually in $HOME/.measur3r

Version 1.2
- fix in calculations for screens that have width smaller than height (thanks to MochiMoppel)

Version 1.3
- added 'Repeat' button (thanks to charlie6)
- better compatibility with _real_ xmessage

Have fun &
Greetings!
measur3r_lite-1.3.pet
Description  Supports only pixel units.
pet

 Download 
Filename  measur3r_lite-1.3.pet 
Filesize  1.8 KB 
Downloaded  288 Time(s) 
measur3r-1.3.pet
Description 
pet

 Download 
Filename  measur3r-1.3.pet 
Filesize  2.35 KB 
Downloaded  305 Time(s) 
Screenshot.png
 Description   
 Filesize   7.32 KB
 Viewed   753 Time(s)

Screenshot.png


_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.

Last edited by SFR on Tue 28 Apr 2015, 11:51; edited 5 times in total
Back to top
View user's profile Send private message 
mister_electronico


Joined: 20 Jan 2008
Posts: 955
Location: Asturias_ España

PostPosted: Tue 03 Mar 2015, 17:08    Post subject: Hi SFR  

Hi SFR the program seems very interesting, but can not get it to work.

If I run through terminal gives me the following error

awk: fatal: division by zero attempted
awk: fatal: division by zero attempted


I am working with Slacko Puppy 5.6 Non-PAE.

I find it very interesting.



Greetings!






________________________________________________________________________
My Blog

https://misterelectronicoes.wordpress.com/trainer-board-homemade/
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger 
SFR


Joined: 26 Oct 2011
Posts: 1647

PostPosted: Tue 03 Mar 2015, 17:23    Post subject:  

Hmm, I think you're facing the same problem as Jasper here: http://www.murga-linux.com/puppy/viewtopic.php?p=831820#831820
I've no idea why in my (and MochiMoppel's, and Geoffrey's) case xrandr reports real screen dimensions and in your and Jasper's not...

Anyway, as a workaround you could (if you know your display's actual dimensions, in millimeters) alter the code and hardcode these values right after this line, e.g.:
Code:
read MM_X MM_Y <<< `xrandr | grep -wo -m1 '[0-9]*mm x [0-9]*mm' | tr -cd '[0-9]x' | awk -F "x" '{print $1" "$2}'`

# hardcoded:
MM_X=267
MM_Y=200

Thanks for you interest &
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
mister_electronico


Joined: 20 Jan 2008
Posts: 955
Location: Asturias_ España

PostPosted: Tue 03 Mar 2015, 18:54    Post subject: You are in true.  

Hi SFR you are in true, I don't know why :

read MM_X MM_Y <<< `xrandr | grep -wo -m1 '[0-9]*mm x [0-9]*mm' | tr -cd '[0-9]x' | awk -F "x" '{print $1" "$2}'`

do
MM_X = 0
and

MM_Y = 0

But like you said I change :


MM_X = 320
MM_Y = 200

Is my case:

#xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 1920 x 1920
VGA-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1080 60.0*+
DVI-0 disconnected (normal left inverted right x axis y axis)


and works...

So thanks SFR .... good program.

Greetings!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger 
charlie6


Joined: 30 Jun 2008
Posts: 1179
Location: Saint-Gérard / Walloon part of Belgium

PostPosted: Tue 28 Apr 2015, 10:09    Post subject:  

Hi SFR,
this is really an awesome app ! thanks for it also !

I regularly reads drawings on screen and have to estimate dimensions ...using a ruler and doing measurments straight onto the screen and performing some cross-multiplication to convert to real size...etc,etc,etc,...funny isn't?! Sad

In ordre to repeat successive measuurments using measur3r, here is what i've found to repeat measur3r start without having to each time select it in the menu.

replace line 69

Code:
xmessage -title "$APPNAME" -center -font monospace -bg yellow "$RESULT"


by the following 6 lines

Code:
xmessage -buttons "REPEAT,RESUME" -title "$APPNAME" -center -font monospace -bg yellow "$RESULT"
ANSWER=$?

if [ $ANSWER -eq 101 ]; then
exec measur3r
fi


HTH
Charlie
measur3r.png
 Description   
 Filesize   12.94 KB
 Viewed   453 Time(s)

measur3r.png

Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1647

PostPosted: Tue 28 Apr 2015, 11:51    Post subject:  

Yeah, good idea, added in v1.3.

Thanks &
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4755
Location: Republic of Novo Zelande

PostPosted: Wed 22 Jul 2015, 04:56    Post subject:  

Nice app. I find the lite version works for me as the full version (and rul3r) gives me the following output:
unable_to_determine.jpg
 Description   
 Filesize   27.86 KB
 Viewed   325 Time(s)

unable_to_determine.jpg

Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1647

PostPosted: Wed 22 Jul 2015, 05:11    Post subject:  

Yes, in some cases, I don't know why, xrandr doesn't report physical size of the display (see my post above).
If you know the real dimensions, just follow the instructions (echo "X_MM Y_MM" ...).

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8660
Location: qld

PostPosted: Wed 22 Jul 2015, 05:30    Post subject:  

Just a note - xrandr is an extension which all drivers (Xorg drivers) don't necessarily support. (vesa, modesetting, fb etc)

here is a C snippet that gets it - use with caution (wont work over hdmi)
Code:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>

// application entry point
int main(int argc, char* argv[])
{
  int fbfd = 0; // framebuffer filedescriptor
  struct fb_var_screeninfo var_info;

  // Open the framebuffer device file for reading and writing
  fbfd = open("/dev/fb0", O_RDWR);
  if (fbfd == -1) {
    printf("Error: cannot open framebuffer device.\n");
    return(1);
  }
  printf("The framebuffer device opened.\n");

  // Get variable screen information
  if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var_info)) {
    printf("Error reading variable screen info.\n");
  }
  printf("Display info %dx%d, %d bpp\n",
         var_info.xres, var_info.yres,
         var_info.bits_per_pixel );

  // close file 
  close(fbfd);
 
  return 0;

}


Dunno if there is equivalent lib in bash.

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
Puppyt

Joined: 09 May 2008
Posts: 758
Location: Gatton, Queensland

PostPosted: Mon 23 Oct 2017, 09:53    Post subject:  

Thank you SFR!
I just needed to compare two distances in (generally) non-vertical or non-horizontal directions on-screen, and measur3r 1.3 seems to have done the deed for me in terms of pixel distance results. Cheers!

_________________
What I get up to when I'm not on the Puppy Linux Murga forum:
http://scholar.google.com/citations?user=EMQxfgYAAAAJ
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 12723
Location: Arizona USA

PostPosted: Mon 23 Oct 2017, 15:58    Post subject:  

Huh. I never saw this before. It works fine in Quirky Werewolf 64-bit.

I have two suggestions: 1.) The point of the arrow I use for a cursor would be more accurate for finding a pixel than is the cross that measure3r uses - the cross is kind of broad. And 2.) Wouldn't this be better in Graphic, not Business?

But it really works well for me. Thanks, SFR!

I was able to move the window by dragging its edges to where I wanted them.
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1647

PostPosted: Mon 23 Oct 2017, 17:36    Post subject:  

Puppyt wrote:
Thank you SFR!
I just needed to compare two distances in (generally) non-vertical or non-horizontal directions on-screen, and measur3r 1.3 seems to have done the deed for me in terms of pixel distance results. Cheers!

You're welcome, glad it does what you wanted it to do.
___________

Flash wrote:
The point of the arrow I use for a cursor would be more accurate for finding a pixel than is the cross that measure3r uses - the cross is kind of broad.

I don't really have control over it - the shape of the mouse pointer comes from xwininfo utility, which is used by measur3r to aquire screen coordinates without interacting with what's on screen.

Flash wrote:
Wouldn't this be better in Graphic, not Business?

Yep, Business doesn't fit, indeed...but it's in Engineering/Science/Simulation. Wink

Flash wrote:
I was able to move the window by dragging its edges to where I wanted them.

Yeah, in some window managers (Openbox, Compiz) (g)xmessage's window has titlebar, but in JWM it doesn't, because of this (usually in /etc/xdg/templates/_root_.jwmrc, but YMMV):
Code:
<Group>
   <Name>xmessage</Name>
   <!-- <Option>icon:info16.xpm</Option> -->
   <Option>notitle</Option>
   <Option>nolist</Option>
</Group>

Anyway, you can also move it using Alt+Left_Mouse_Button.

Thanks &
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
Puppyt

Joined: 09 May 2008
Posts: 758
Location: Gatton, Queensland

PostPosted: Mon 23 Oct 2017, 19:45    Post subject:  

Ah yes - in my haste I didn't provide testing details - I'm running measur3r in TahrPup32, v6.0.5, using the JWM environment. My screenie confirms Flash's observation that it winds up in "Business" - but it does the business, I guess. "Graphics" would also be my preference, all things considered.
(or I could rename my "Business" menu category more appropriately as "Science". No dramas...)

Flash refers to an issue I had reported to in another thread (http://murga-linux.com/puppy/viewtopic.php?t=111913) concerning the output dialogue. I will try the ALT+left click again in JWM to move it to a more practical location than center screen,
Cheers!
measur3r_tahrpup32.jpg
 Description   Screenie of measur3r (v 1.3) in TahrPup32 6.0.5
 Filesize   73.17 KB
 Viewed   60 Time(s)

measur3r_tahrpup32.jpg


_________________
What I get up to when I'm not on the Puppy Linux Murga forum:
http://scholar.google.com/citations?user=EMQxfgYAAAAJ
Back to top
View user's profile Send private message Visit poster's website 
Puppyt

Joined: 09 May 2008
Posts: 758
Location: Gatton, Queensland

PostPosted: Mon 23 Oct 2017, 22:50    Post subject:  

OK so Alt+left_mouse works a treat, thanks. Found that I can have multiple instances of measur3r going for immediate comparisons. In the example below I have a measure for the distance between two wires, illustrated by the white rectangle, in the dialogue to the right. On the left I have projected the width of the feed bunk at that distance (with due estimation of the vanishing points), shown in the red line (hmm looks off by about 2-3 degrees of rotation, seeing it from a distance). This image was made by using PrtScn and then adding the measurement lines in mtpaint 3.44.88, all done in TahrPup 6.0.5 (32bit) and JWM. Hope others find this really useful Smile

PS I can even highlight select text in any dialogue - in grey and not shown here - but unfortunately only one dialogue will have the highlighted text at any one time. No biggie
measur3r eg.jpg
 Description   Demo of multiple instances of measur3r open simultaneously
 Filesize   35.94 KB
 Viewed   56 Time(s)

measur3r eg.jpg


_________________
What I get up to when I'm not on the Puppy Linux Murga forum:
http://scholar.google.com/citations?user=EMQxfgYAAAAJ
Back to top
View user's profile Send private message Visit poster's website 
greengeek


Joined: 20 Jul 2010
Posts: 4755
Location: Republic of Novo Zelande

PostPosted: Tue 24 Oct 2017, 02:26    Post subject:  

SFR wrote:
Flash wrote:
Wouldn't this be better in Graphic, not Business?

Yep, Business doesn't fit, indeed...but it's in Engineering/Science/Simulation. Wink
!
What Flash means is that it appears in the "Business" portion of the main Puppy menu (rather than referring to which "murga forum" subsection).

"Business" is probably a reasonable place for it since "calculator" is also there... but why isn't there a "Technical" subsection to the puppy menu? Thats where the Calculator and Ruler functions really should be. (Maybe it's an XDG or similar limitation - dependent on the big distros?)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Engineering/Science/Simulation
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0866s ][ Queries: 14 (0.0048s) ][ GZIP on ]