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 Fri 28 Aug 2015, 01:26
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 1 [9 Posts]  
Author Message
SFR


Joined: 26 Oct 2011
Posts: 1311

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  74 Time(s) 
measur3r-1.3.pet
Description 
pet

 Download 
Filename  measur3r-1.3.pet 
Filesize  2.35 KB 
Downloaded  88 Time(s) 
Screenshot.png
 Description   
 Filesize   7.32 KB
 Viewed   399 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: 830
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: 1311

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: 830
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: 1105
Location: South 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   179 Time(s)

measur3r.png

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


Joined: 26 Oct 2011
Posts: 1311

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: 3218
Location: New Zealand

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   74 Time(s)

unable_to_determine.jpg

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


Joined: 26 Oct 2011
Posts: 1311

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: 8025
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.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
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.1354s ][ Queries: 12 (0.0116s) ][ GZIP on ]