It is currently 21 Jan 2018, 18:05

GIMP Python Fu ScriptsPath Save and Load Script for GIMP (Showcase | Slideshow)

Share your Python Fu scripts for GIMP here
Post Reply
User avatar
trandoductin

Forum Member
View: Showcase | Slideshow
Topic Posts: 1/1
Posts: 189
Joined: 25 Sep 2016, 17:21
Cash on hand: 317.58 GLP
Gender: Guy
Location: Canada
Website: https://gimplearn.net
x 7
Contact:
Canada

Path Save and Load Script for GIMP

Post#1 by trandoductin » 10 Oct 2016, 20:42


I looked at Path/Vectors Export and Import and it seems it only does absolute loading.
So I wrote this script to "Save" and "Load" Path with 3 extra loading methods on top of ABSOLUTE(pixels) mode
RELATIVE (percentage) -- this mode will scale based on image width and height
RELATIVE WIDTH KEEP ASPECT RATIO -- this mode will scale based on width keeping aspect ratio of original path when saved.
RELATIVE HEIGHT KEEP ASPECT RATIO -- this mode will scale based on height keeping aspect ratio of original path when saved.
here's the script: (right click the path/vector and choose Load... or Save..., you must have at least one path/vector even if it's just empty to access these menus).
:download:
Path_Save_Load_2.zip #
(2.89 KiB) Downloaded 51 times
:download:
Path_Save_Load_3.zip #
zipped .py file (unzip and put in your GIMP's plug-ins folder)
(3.04 KiB) Downloaded 61 times
Version 3 works on selection bounding box

Right click the path/vector to access these menus, You must have at least one path/vector even if it's just empty.
Path_Save_Load_01_menu_location_right_click_path.png
Path_Save_Load_01_menu_location_right_click_path.png # (32.5 KiB) Viewed 1035 times (Watermarked | Thumbnail)
Save just gives you a text field where you can type in a name to save it under.
Path_Save_Load_02_Save_Option.png
Path_Save_Load_02_Save_Option.png # (10.78 KiB) Viewed 1035 times (Watermarked | Thumbnail)
Load options (choose a name, and a load method):
Path_Save_Load_03_Load_Options.png
Path_Save_Load_03_Load_Options.png # (15.92 KiB) Viewed 1035 times (Watermarked | Thumbnail)
For example if you've saved a path like this:
Path_Save_Load_04_Example_Saved_path.png
Path_Save_Load_04_Example_Saved_path.png # (10.26 KiB) Viewed 1035 times (Watermarked | Thumbnail)
Other than absolute mode which is obvious, this is what RELATIVE(percentage) method looks like on a wider image.
Path_Save_Load_04_Load_Relative_percentage.png
Path_Save_Load_04_Load_Relative_percentage.png # (7.18 KiB) Viewed 1035 times (Watermarked | Thumbnail)
RELATIVE WIDTH KEEP ASPECT RATIO method (on a wider image)
Path_Save_Load_05_Load_Relative_Width_Keep_aspect.png
Path_Save_Load_05_Load_Relative_Width_Keep_aspect.png # (11.06 KiB) Viewed 1035 times (Watermarked | Thumbnail)
RELATIVE HEIGHT KEEP ASPECT RATIO method (on a wider image)
Path_Save_Load_06_Load_Relative_Height_Keep_aspect.png
Path_Save_Load_06_Load_Relative_Height_Keep_aspect.png # (4.02 KiB) Viewed 1035 times (Watermarked | Thumbnail)
All paths will be saved in a text file under [username]/.gimp-2.8/paths/paths.txt
The file will look something like this.

Code: Select all

Path:Star And Circle|400.0,400.0|268.440095762,285.81958011,267.996293997,325.0,267.931604531,330.711019305,266.619146569,337.675767365,264.537597709,343.0,261.80670043,349.985150672,257.589473193,356.368218156,252.561855184,361.911668487,247.573241524,367.412112635,238.851612364,373.185123341,232.0,376.128146693,221.621872236,380.585940091,212.209149488,382.12741562,201.0,381.996293997,167.741919071,381.607249889,138.617515068,356.094328153,139.003706003,322.0,139.07672851,315.553309801,140.675022622,307.887432911,143.311474398,302.0,146.222117377,295.50027358,150.330684159,289.297946166,155.288143934,284.169065208,165.911288392,273.178589079,180.252652922,267.842333578,195.0,265.427588322,231.809630275,260.882026504,1|173.0,109.0,173.0,109.0,173.0,109.0,202.0,36.0,202.0,36.0,202.0,36.0,235.0,111.0,235.0,111.0,235.0,111.0,315.0,119.0,315.0,119.0,315.0,119.0,255.0,175.0,255.0,175.0,255.0,175.0,276.0,243.0,276.0,243.0,276.0,243.0,197.0,213.0,197.0,213.0,197.0,213.0,139.0,251.0,139.0,251.0,139.0,251.0,151.0,165.0,151.0,165.0,151.0,165.0,89.0,111.0,89.0,111.0,89.0,111.0,1
Path:Star And Circle 2|500,200|134.220047881,142.909790055,133.998146999,162.5,133.965802266,165.355509652,133.309573285,168.837883683,132.268798855,171.5,130.903350215,174.992575336,128.794736597,178.184109078,126.280927592,180.955834243,123.786620762,183.706056318,119.425806182,186.592561671,116.0,188.064073347,110.810936118,190.292970045,106.104574744,191.06370781,100.5,190.998146999,83.8709595355,190.803624945,69.308757534,178.047164076,69.5018530015,161.0,69.538364255,157.776654901,70.337511311,153.943716456,71.655737199,151.0,73.1110586885,147.75013679,75.1653420795,144.648973083,77.644071967,142.084532604,82.955644196,136.58929454,90.126326461,133.921166789,97.5,132.713794161,115.904815137,130.441013252,1|86.5,54.5,86.5,54.5,86.5,54.5,101.0,18.0,101.0,18.0,101.0,18.0,117.5,55.5,117.5,55.5,117.5,55.5,157.5,59.5,157.5,59.5,157.5,59.5,127.5,87.5,127.5,87.5,127.5,87.5,138.0,121.5,138.0,121.5,138.0,121.5,98.5,106.5,98.5,106.5,98.5,106.5,69.5,125.5,69.5,125.5,69.5,125.5,75.5,82.5,75.5,82.5,75.5,82.5,44.5,55.5,44.5,55.5,44.5,55.5,1
Each path is just a single line that starts with "Path:" then the Path name.
Followed by a pipe (|) then followed by width and height separated by a comma.
Followed by a pipe, then control points of a stroke and close/open flag (integer) all separated by commas
Other strokes follow if they exist all separated by pipes.
0 x



T.
please don't message me, message tim(admin) instead as I am tim(admin). I don't check this account very often.
To message tim(admin), click here. Thanks.

Registered members enjoy ads-free content
Post Reply

Last 20 Members Who Visited This Topic

User avatar gnerd (1)

  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments Only) •
1: Alan
2: Issabella
3: Pat625
4: Ella
5: Conbagui
6: Pat625
7: dinasset

Who is online

Users browsing this forum: No registered users and 3 guests