gimpusers.com logo
German version English version

Not logged in

Sign up! | Lost password?

Latest discussion

  1. gimp-user | today 09:49 AM
    Need help: "correcting" exposures in time-lapse imagesets
  2. gimp-developer | today 06:14 AM
    GIMP color-management spec and further discussion
  3. gimp-user | yesterday 11:13 PM
    collages in gimp?
  4. gimp-developer | yesterday 07:07 PM
    Color management (UI perspective for GIMP 2.8)
  5. gimp-user | yesterday 02:42 PM
    printing

External news

Poll

Would you like to be able to use your Google/Yahoo/MSN (OpenID) login on gimpusers, too?

Definately! I would enjoy the possibility to use my OpenID on different websites!

I don't have a special need for OpenID but I think it could be useful

Doesn't matter to me

Never, OpenID is a pain regarding privacy and personal data protection!

No. (please post a comment)

See results

Stats

gimpusers.com RSS feed

GIMP Forums » For GIMP developers

Improvement for measurement tool

Jump to message:

  1. message 4A51AE5F.8040106@kamerastars.de not available
    1. Improvement for... — Chris Mohler, 06 Jul 2009 07:26 PM
  2. Improvement for... — Dirk Sohler, 05 Jul 2009 04:51 PM
    1. Improvement for... — Chris Mohler, 05 Jul 2009 09:38 PM
    2. Improvement for... — Chris Mohler, 05 Jul 2009 10:11 PM
      1. Improvement for... — Alec Burgess, 06 Jul 2009 04:42 AM
        1. Improvement for... — Chris Mohler, 06 Jul 2009 07:36 PM
          1. Improvement for... — Rob Antonishen, 06 Jul 2009 07:41 PM
            1. Improvement for... — Chris Mohler, 06 Jul 2009 07:46 PM
        2. Improvement for... — Sven Neumann, 06 Jul 2009 09:55 PM
          1. Improvement for... — Chris Mohler, 06 Jul 2009 11:58 PM
            1. Improvement for... — Sven Neumann, 07 Jul 2009 12:19 AM
              1. Improvement for... — Chris Mohler, 07 Jul 2009 12:32 AM
                1. Improvement for... — Sven Neumann, 07 Jul 2009 12:45 AM
                  1. Improvement for... — Chris Mohler, 07 Jul 2009 12:58 AM
        3. Improvement for... — Chris Mohler, 07 Jul 2009 12:03 AM

As a registered user, you can subscribe forum threads in order to get notified when replies are posted. Just log in at the right top of the page if you already have an account, otherwise you can register for free.

Permalink:acfad57e0907061026m1723633fx35da16781...
Date:06 Jul 2009 07:26 PM
From:Chris Mohler
Subject:Improvement for measurement tool
On Mon, Jul 6, 2009 at 2:57 AM, Dirk
Sohler<gimp-developer-ml@kamerastars.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Chris Mohler schrieb:
> | What the heck - I added it as a (very) simple plug-in:
> | http://registry.gimp.org/node/17235
>
> I can’t find the menu option „Filters->Measure->Path“. :(

Hmm - did you place the plug-in into ~/.gimp-2.x/plug-ins and is it
executable? (chmod +x)

If so, try starting GIMP from a terminal and see if it throws an error?

Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:4A50BDF3.2070100@kamerastars.de
Date:05 Jul 2009 04:51 PM
From:Dirk Sohler
Subject:Improvement for measurement tool
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there!

I filed a “bug” with an enhancement request to the GIMP Bugzilla, but
Martin Nordholts told me, to send a mail to the GIMP developers mailing
list first, so … here it is :)


I had a kind of map opened as image in GIMP. I used the path tool and
clicked a path alon a route i want to measure. After i did this i tried
to get the path’s length. But i noticed really soon, that it is not
possible to output the path’s total length without learning script-fu.

In the second try i used the measurement tool. But this did not work
neither, because the measurement tool only allows up to two segments
connectet with only one node.

I worked around this by using the measurement tool with it maximum only
two segments, wrote all lengths down and calculated the full length after.

There were “only” 17 values i got, but at least, it worked … kinda.

It would be very good, if …

1. the measurement tool would be able to create as many segments as
needed, giving the total length.

… or …

2. there would be a possibility to output the total length of a path.


Kind regards,
Dirk


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpQvfEACgkQeMa2LiFY07syDACgwYeXm6mPIq3xSiG8xh4ox8mp
WF0An0C2EXpnSe5FrQhFCbGc7oin151t
=0S7s
-----END PGP SIGNATURE-----
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907051238y3cfcc87dm31dee8616...
Date:05 Jul 2009 09:38 PM
From:Chris Mohler
Subject:Improvement for measurement tool
On Sun, Jul 5, 2009 at 9:51 AM, Dirk
Sohler<gimp-developer-ml@kamerastars.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi there!
>
> I filed a “bug” with an enhancement request to the GIMP Bugzilla, but
> Martin Nordholts told me, to send a mail to the GIMP developers mailing
> list first, so … here it is :)
>
>
> I had a kind of map opened as image in GIMP. I used the path tool and
> clicked a path alon a route i want to measure. After i did this i tried
> to get the path’s length. But i noticed really soon, that it is not
> possible to output the path’s total length without learning script-fu.

Hmm - it would probably not be too hard to write a plugin for this.

As a quick test, I created a new image, drew a path, and stroked it.

Then I opened the python console and did:

>>> img = gimp.image_list()[0]
>>> path = pdb.gimp_image_get_active_vectors(img)
>>> len = pdb.gimp_vectors_stroke_get_length(path, 1, 1)
>>> print len
644.628491517

That might choke if you have more than one path - I have not tested.

Is this enough to get you going?

Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907051311l428e28ccvd59028b88...
Date:05 Jul 2009 10:11 PM
From:Chris Mohler
Subject:Improvement for measurement tool
On Sun, Jul 5, 2009 at 9:51 AM, Dirk
Sohler<gimp-developer-ml@kamerastars.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi there!
>
> I filed a “bug” with an enhancement request to the GIMP Bugzilla, but
> Martin Nordholts told me, to send a mail to the GIMP developers mailing
> list first, so … here it is :)
>
>
> I had a kind of map opened as image in GIMP. I used the path tool and
> clicked a path alon a route i want to measure. After i did this i tried
> to get the path’s length. But i noticed really soon, that it is not
> possible to output the path’s total length without learning script-fu.

What the heck - I added it as a (very) simple plug-in:
http://registry.gimp.org/node/17235

In 2.6. it returns the length of the path on the status bar. I used
gimp_message, so IIRC the location of the message is configurable. It
silently fails if there is no active path - it seems to work OK with
multiple paths, straight lines, and curves. There is no need to
stroke the path.

You will need to have Python installed though...

HTH,
Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:4A516485.8040301@gmail.com
Date:06 Jul 2009 04:42 AM
From:Alec Burgess
Subject:Improvement for measurement tool

Chris Mohler (cr33dog@gmail.com) wrote (in part) (on 2009-07-05 at
16:11):
> What the heck - I added it as a (very) simple plug-in:
> http://registry.gimp.org/node/17235 In 2.6. it returns the length of
> the path on the status bar. I used gimp_message, so IIRC the location
> of the message is configurable. It silently fails if there is no
> active path - it seems to work OK with multiple paths, straight
> lines, and curves. There is no need to stroke the path. You will need
> to have Python installed though...

Works on Windows 2.6.6 but message is displayed in Error console (which
I have as one of panels in main dock) not on the status bar. Is this
somehow configurable?

Note: IMO this is a feature not a bug since it allows user to change the
path and re-measure leaving a "history" record in the Error console.

Unlike some "error" messages posted to Error console it does not
auto-raise the error console if the panel it is in is displaying
something else.

Note: I tested by using Supernova filter on a white background,
selecting white, inverting and then Select to Path and named it Path_A.
Response to Measure-Path in Error console was: Path Warning Length of
Path_A: 3474 px. That would have taken an extremely long time to
calculate with the measure tool :-)

Whether paths are Active or not does not appear to change results - it
still shows the measurement.

I created a second much simpler path with Free-Select-Tool then
converted to path and named it "Path_B". With the two paths it showed:
Length of Path_B: 383 px.

It appears (based on swapping order of paths with drag+drop) that it
always shows the length of the lowest path (the one a the bottom of the
list)

Bug?: The entry "Filters - Measurement - Path" is always enabled whether
or not any path exists (expected) but in Filters-Repeat "Path",
Filters-Reshow "Path" and Filters-Recently Used-Path it always shows as
Disabled (grayed out).
Is this an easy fix?

For reference in case someone other than Chris knows the answer, text of
the python plugin follows:

#!/usr/bin/env python
# Author: Chris Mohler
# Copyright 2009 Chris Mohler
# License: GPL v3
# GIMP plugin to measure the length of a path

from gimpfu import *

gettext.install("gimp20-python", gimp.locale_directory, unicode=True)


def measure_path(img, drw):
try:
path = pdb.gimp_image_get_active_vectors(img)
len = pdb.gimp_vectors_stroke_get_length(path, 1, 1)
len = int(len)
pdb.gimp_message("Length of " + path.name + ": " + str(len) + " px")
except:
pass

register(
"python-fu-measure-path",
"Measure Path",
"Measure Length of the Active Path",
"Chris Mohler",
"Chris Mohler",
"2009",
"<Image>/Filters/Measure/Path",
"",
[],
[],
measure_path,
domain=("gimp20-python", gimp.locale_directory)
)

main()


--
Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)



_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

↑Back to thread overview
Permalink:acfad57e0907061036ve5d83dam99a84ff428...
Date:06 Jul 2009 07:36 PM
From:Chris Mohler
Subject:Improvement for measurement tool
On Sun, Jul 5, 2009 at 9:42 PM, Alec Burgess<buralex@gmail.com> wrote:

> Works on Windows 2.6.6 but message is displayed in Error console (which I
> have as one of panels in main dock) not on the status bar. Is this somehow
> configurable?
>
> Note: IMO this is a feature not a bug since it allows user to change the
> path and re-measure leaving a "history" record in the Error console.

OK - I don't usually open the error console, but I see the same
behavior in linux with the console open. I pretty much did just the
bare minimum on the plug-in, but I'm pretty sure it's possible to make
it pop up a message instead, and/or change the message type.


> Whether paths are Active or not does not appear to change results - it still
> shows the measurement.
>
> I created a second much simpler path with Free-Select-Tool then converted to
> path and named it "Path_B". With the two paths it showed: Length of Path_B:
> 383 px.
>
> It appears (based on swapping order of paths with drag+drop) that it always
> shows the length of the lowest path (the one a the bottom of the list)

For me, it gives the length of whatever path is selected in the paths
dialog. I will install the plugin in Windows at some point and see if
I can reproduce...


> Bug?: The entry "Filters - Measurement - Path" is always enabled whether or
> not any path exists (expected) but in Filters-Repeat "Path",  Filters-Reshow
> "Path" and Filters-Recently Used-Path it always shows as Disabled (grayed
> out).
> Is this an easy fix?

I see the same thing here - I'm not sure what's happening. I will
investigate when I find some time...


Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:3644709b0907061041m783e28c8w176251744...
Date:06 Jul 2009 07:41 PM
From:Rob Antonishen
Subject:Improvement for measurement tool
>> Bug?: The entry "Filters - Measurement - Path" is always enabled whether or
>> not any path exists (expected) but in Filters-Repeat "Path",  Filters-Reshow
>> "Path" and Filters-Recently Used-Path it always shows as Disabled (grayed
>> out).
>> Is this an easy fix?
>
> I see the same thing here - I'm not sure what's happening.  I will
> investigate when I find some time...

I think that if you change the image type to "*" rather than "" it
will be remembered.

-Rob A>
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907061046h7ac574c1x83bed694b...
Date:06 Jul 2009 07:46 PM
From:Chris Mohler
Subject:Improvement for measurement tool
On Mon, Jul 6, 2009 at 12:41 PM, Rob Antonishen<rob.antonishen@gmail.com> wrote:
>>> Bug?: The entry "Filters - Measurement - Path" is always enabled whether or
>>> not any path exists (expected) but in Filters-Repeat "Path",  Filters-Reshow
>>> "Path" and Filters-Recently Used-Path it always shows as Disabled (grayed
>>> out).
>>> Is this an easy fix?
>>
>> I see the same thing here - I'm not sure what's happening.  I will
>> investigate when I find some time...
>
> I think that if you change the image type to "*" rather than "" it
> will be remembered.

I think you are right - thanks!

Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:1246910131.13862.6.camel@bender
Date:06 Jul 2009 09:55 PM
From:Sven Neumann
Subject:Improvement for measurement tool
Hi,

On Sun, 2009-07-05 at 22:42 -0400, Alec Burgess wrote:

> Works on Windows 2.6.6 but message is displayed in Error console
> (which I have as one of panels in main dock) not on the status bar. Is
> this somehow configurable?
>
> Note: IMO this is a feature not a bug since it allows user to change
> the path and re-measure leaving a "history" record in the Error
> console.

If the error-console is opened, all messages are redirected there. The
ideas is that the error-console is only useful when debugging or
developing scripts.

> Bug?: The entry "Filters - Measurement - Path" is always enabled
> whether or not any path exists (expected) but in Filters-Repeat
> "Path", Filters-Reshow "Path" and Filters-Recently Used-Path it
> always shows as Disabled (grayed out).
> Is this an easy fix?

This might fix itself if you change your script not to use the
deprecated register() API. You should instead use the variant that
passes the menu location as value of the named parameter 'menu'. The way
your script is using register() triggers an obscure backward
compatibility quirks mode, which is probably not what you want.


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907061458w5f8f2b9cjf286958ad...
Date:06 Jul 2009 11:58 PM
From:Chris Mohler
Subject:Improvement for measurement tool
On Mon, Jul 6, 2009 at 2:55 PM, Sven Neumann<sven@gimp.org> wrote:
> On Sun, 2009-07-05 at 22:42 -0400, Alec Burgess wrote:
>> Bug?: The entry "Filters - Measurement - Path" is always enabled
>> whether or not any path exists (expected) but in Filters-Repeat
>> "Path",  Filters-Reshow "Path" and Filters-Recently Used-Path it
>> always shows as Disabled (grayed out).
>> Is this an easy fix?
>
> This might fix itself if you change your script not to use the
> deprecated register() API. You should instead use the variant that
> passes the menu location as value of the named parameter 'menu'. The way
> your script is using register() triggers an obscure backward
> compatibility quirks mode, which is probably not what you want.

I had a little trouble finding docs on the named parameters (I ended
up using help(gimpfu.register) in the console). I've pasted the new
register() below - one thing seemed strange: the 'params' parameter
seems to require that I add the current image and drawable - is that
correct? Any other big mistakes here? ;)

Thanks,
Chris

register(
proc_name=("python-fu-measure-path"),
blurb=("Measure Path"),
help=("Measure Length of the active path. Output is directed to
the Status Bar or Error Console."),
author=("Chris Mohler"),
copyright=("Chris Mohler"),
date=("2009"),
label=("Active Path"),
imagetypes=("*"),
params=[
(PF_IMAGE, "img", "Image", None),
(PF_DRAWABLE, "drw", "Drawable", None)
],
results=[],
function=(measure_path),
menu=("<Image>/Filters/Measure"),
domain=("gimp20-python", gimp.locale_directory)
)
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:1246918754.13862.16.camel@bender
Date:07 Jul 2009 12:19 AM
From:Sven Neumann
Subject:Improvement for measurement tool
Hi,

On Mon, 2009-07-06 at 16:58 -0500, Chris Mohler wrote:

> I had a little trouble finding docs on the named parameters (I ended
> up using help(gimpfu.register) in the console). I've pasted the new
> register() below - one thing seemed strange: the 'params' parameter
> seems to require that I add the current image and drawable - is that
> correct? Any other big mistakes here? ;)

Why does it require that? What's required is that you register all the
parameters that your function actually needs. If you need an image
parameter, then you should have PF_IMAGE in your input parameters. If
you also need a drawable, then this should be followed by PF_DRAWABLE.
But these are by no means obligatory. If you don't need an image nor a
drawable, then you can safely omit them.


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907061532s2bcc79f0x8bf726ebe...
Date:07 Jul 2009 12:32 AM
From:Chris Mohler
Subject:Improvement for measurement tool
On Mon, Jul 6, 2009 at 5:19 PM, Sven Neumann<sven@gimp.org> wrote:
> Hi,
>
> On Mon, 2009-07-06 at 16:58 -0500, Chris Mohler wrote:
>
>> I had a little trouble finding docs on the named parameters (I ended
>> up using help(gimpfu.register) in the console).  I've pasted the new
>> register() below - one thing seemed strange: the 'params' parameter
>> seems to require that I add the current image and drawable - is that
>> correct?  Any other big mistakes here?  ;)
>
> Why does it require that? What's required is that you register all the
> parameters that your function actually needs. If you need an image
> parameter, then you should have PF_IMAGE in your input parameters. If
> you also need a drawable, then this should be followed by PF_DRAWABLE.
> But these are by no means obligatory. If you don't need an image nor a
> drawable, then you can safely omit them.

Sorry - I did not phrase that very well.

When using the old, unnamed register() parameters, if you leave
'params' empty, the main plug-in function still receives two
parameters - the current image and drawable. Using the new, named
register() parameters does not seem to do this anymore.

No big deal really, but I thought it odd that the behavior would be different.

Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:1246920321.13862.21.camel@bender
Date:07 Jul 2009 12:45 AM
From:Sven Neumann
Subject:Improvement for measurement tool
Hi,

On Mon, 2009-07-06 at 17:32 -0500, Chris Mohler wrote:

> When using the old, unnamed register() parameters, if you leave
> 'params' empty, the main plug-in function still receives two
> parameters - the current image and drawable. Using the new, named
> register() parameters does not seem to do this anymore.
>
> No big deal really, but I thought it odd that the behavior would be different.

That is exactly the odd quirks mode for backward compatibility that I
mentioned. If you use the old register() API, then parameters are added
for you depending on the menu location your script is registering to. As
that is hard to understand and frequently leads to automatically added
parameters that the script does not actually need, this behavior was
changed. It is still there, for backward compatibility, if you use the
old API though.


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907061558y1258e798y1daa859df...
Date:07 Jul 2009 12:58 AM
From:Chris Mohler
Subject:Improvement for measurement tool
On Mon, Jul 6, 2009 at 5:45 PM, Sven Neumann<sven@gimp.org> wrote:
> Hi,
>
> On Mon, 2009-07-06 at 17:32 -0500, Chris Mohler wrote:
>
>> When using the old, unnamed register() parameters, if you leave
>> 'params' empty, the main plug-in function still receives two
>> parameters - the current image and drawable.  Using the new, named
>> register() parameters does not seem to do this anymore.
>>
>> No big deal really, but I thought it odd that the behavior would be different.
>
> That is exactly the odd quirks mode for backward compatibility that I
> mentioned. If you use the old register() API, then parameters are added
> for you depending on the menu location your script is registering to. As
> that is hard to understand and frequently leads to automatically added
> parameters that the script does not actually need, this behavior was
> changed. It is still there, for backward compatibility, if you use the
> old API though.

OK - thanks for clarifying that. I had no idea that the automatic
parameters varied based on menu location.

Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview
Permalink:acfad57e0907061503x4a82c3a6v9af80ecf2...
Date:07 Jul 2009 12:03 AM
From:Chris Mohler
Subject:Improvement for measurement tool
On Sun, Jul 5, 2009 at 9:42 PM, Alec Burgess<buralex@gmail.com> wrote:

> Whether paths are Active or not does not appear to change results - it still
> shows the measurement.

I've updated the plug-in at the registry
(http://registry.gimp.org/node/17235). If in doubt which is which, I
added 'Version 0.2' to the header info of this one.

In linux and XP (both 2.6.6), it reports the length of whichever path
is selected in the Paths dialog.

I also fixed the 'Repeat' and 'Reshow' weirdness, and also disabled
the plug-in when no image is open.

Let me know how it works out...

Chris
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
↑Back to thread overview

Adobe® Photoshop® is a registered trademark of Adobe Systems, Inc. Linux is a trademark of Linus Torvalds. Ubuntu and Canonical are registered trademarks of Canonical Ltd. | Clock times are shown as CET / CEST | Imprint / Privacy policy | powered by bitfire it services