Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Gimp script: Selection area finder

Hybrid View

  1. #1

    Post Gimp script: Selection area finder

    I just wrote a little GIMP script inspired by the discussion here: http://www.cartographersguild.com/showthread.php?t=2279

    It will tell you the perimeter of the current selection in pixels and the area as a percentage of the total image area.

    Installation and use: Once you've installed the .scm file in your gimp scripts directory, "Area and perimeter" is accessible under "Select" from the image menu.

    UPDATE: Version 0.2.0 - added perimeter-finding
    Attached Files Attached Files
    Last edited by isomage; 12-13-2008 at 03:37 AM. Reason: New version
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  2. #2
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,807
    Blog Entries
    4

    Post

    Superb - so you use a selection wand in the area and then ask it how big this is. Cool and probably clearer than using the histogram window.

  3. #3

    Post

    Quote Originally Posted by Redrobes View Post
    Superb - so you use a selection wand in the area and then ask it how big this is
    Yeah, or you could trace the outline with the free select tool if the map's coloring isn't smooth enough for fuzzy select.

    I've also added perimeter-finding and updated the first post.
    Last edited by isomage; 12-12-2008 at 09:45 PM.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  4. #4

    Post

    For a test, I computed the area of Texas using this image.

    The image is 750 x 733 pixels. According to its scale, 96 pixels = 100 miles.

    Selecting Texas and running the script gave 47.2%. The selected area was then (100 / 96)^2 * 750 * 733 * 0.472 = 281556 square miles.

    Wikipedia says that the area of Texas is 268820 square miles. If the map and its scale are perfectly accurate, then we've overestimated by a little less than 5%.

    That's not too bad an estimate, considering that the map may not be perfectly accurate; a scale of 98.2478 pixels per 100 miles, instead of 96, would have given a correct result -- a mere two pixels of difference.
    Last edited by isomage; 12-13-2008 at 03:43 AM.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  5. #5
    Guild Journeyer Sagenlicht's Avatar
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    249

    Post

    once again nice isomage

    Did add it to the GIMP script overview
    My Map Challenge Entries

    I use GIMP for all my maps.

    GIMP scripts and plug-ins overview


    Everything I post on this site uses the Creative Common Attribution-Noncommercial-Share Alike license. Only exception to this are any pyhton scripts which use the GPL.

    If you are using any of my posted stuff just use your rep stick on me

    Should you be interested in using anything I posted on commercial purpose drop me a pm.

  6. #6

    Post

    Note that the histogram function doesn't work on color-indexed images. The script currently will only work in RGB mode, though I may add support for grayscale later.
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  7. #7

    Default

    Hi,

    I follow your instruction isoman but once i installed the file and i select perimeter and area , Gimp heralds me 2 errors
    such as : Calling error for procedure 'gimp-image-add-layer'
    and execution error for Area and perimeter : error procedure execution of .... failed on invalid input arguments : image '... ' is of type 'gray', but an image of type 'rgb' is expected

  8. #8
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,807
    Blog Entries
    4

    Default

    Sounds like you should at least start by upping the color palette from 8 bit greyscale to full 24bit RGB. Not sure about the other one but maybe they are related.

  9. #9
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,807
    Blog Entries
    4

    Default

    In theory it should be right or somewhat close. All I can suggest is that a micro meter is 10^-6 not 10^-3 which is millimeters. So if you were a 1000 or a 1000000 out in area then that could be the case. Otherwise I am not sure.

  10. #10

    Default ;-)

    Quote Originally Posted by Redrobes View Post
    In theory it should be right or somewhat close. All I can suggest is that a micro meter is 10^-6 not 10^-3 which is millimeters. So if you were a 1000 or a 1000000 out in area then that could be the case. Otherwise I am not sure.
    Thx again ;-) So i resolve in part my problem of area assessment :-) But I have an other question :
    How to select a range of pixels (threshold) we are interesting in , in a specific area , whitout to select the all pixel from the picture,
    Now I need to assess the area of Pixel from a certain range of gray ....
    If you have an idea or severals You can submit to me .
    Merci

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •