Re: Improvement for measurement tool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Chris Mohler (cr33dog@xxxxxxxxx) 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@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux