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

Thread: Gimp script: Selection area finder

  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 02:37 AM. Reason: New version
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

  2. #2
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    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 08: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 02: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
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    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

    Default

    Thx a lot for your fast answer, I selected the RGB mode, and then it assest the perimeter as well as the area , however i found that the value are wrong compare to the reality.
    Indeed I'm interesting in the area, and when i compare the number of pixel from the histogram option and the percentage of area ( %*nm of pixel) the value are similar. But when i converted with the real scale , in my case i use 150 micrometers , so I multiplicate the number of pixel per 150*10e-3 and it gives wrong estimation , do you have an idea to assess the superficie with the number of pixel ?
    Merci Beaucoup
    :=)

  10. #10
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,244
    Blog Entries
    8

    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.

Page 1 of 2 12 LastLast

Posting Permissions

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