It is currently Fri Jul 05, 2024 5:13 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 16 posts ] 
Author Message
 Post subject: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 10:31 am  (#1) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I've often wished there were a script or plugin that could set several guidelines at the same time.

I found this plugin while browsing the registry and I've tried it in Gimp 2.8 and it works perfectly.

Add Multiple Guides plug-in

It's a python plugin and you can find it Image > Guides > Mehrere Hilfslinien setzen.

The plug-in is not in English but it's pretty easy to figure out.

Prozentual = percent
Hilfslinie = guideline

http://registry.gimp.org/node/87
Unzip and put into the Gimp plugins folder.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 10:37 am  (#2) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Thank you O

_________________
Image


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 11:13 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Aug 16, 2012
Posts: 4271
Location: Göteborg, Sweden
thank you, O! very useful, it takes so much time to add the guides one by one.

_________________


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 11:16 am  (#4) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
If you're looking for a multitude of ways of placing guides have a look at the Libre Graphics World article on the subject: http://libregraphicsworld.org/blog/entr ... es-in-gimp

Kevin


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 11:48 am  (#5) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Thanks, Kevin. That even has more choices.

I downloaded them all. Don't know whether I'll use them all but they are there if I want one. :mrgreen:

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 11:55 am  (#6) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
thanks Kevin, got it in favorites.

_________________
Image


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 12:17 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Aug 30, 2012
Posts: 2174
Thanks for the Link Kevin, some very handy guide thingy's in there.

_________________
Image


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 12:21 pm  (#8) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
This ones pretty good, Grid of Guides.
http://registry.gimp.org/node/12003

Ed, I just noticed this ones on Kevin's list.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 12:23 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Thanks O.
I fixed this one so it reads in English if anyone is interested. Don't use this code as the indentation is most likely incorrect.Just use it as a template to change the language parts of the code.If you read on Odin has uploaded a correctly indented version as a zip file.

Thanks.
#
# add_multiple_guides_plug.py - 2007 by Christian Nielebock (ravetracer@yahoo.de)
#
# This script allows you to set multiple guide lines in GIMP on given pixel position, horizontal and vertical.
# Just copy it under your home directory in .gimp-2.x/plugins (works with >=2.4) and chmod it for execution.
#
# This script is licensed under the CC-BY-SA Creative Commons License Version 3.0 !
# You can read about the license terms under:
#    (German) http://creativecommons.org/licenses/by-sa/3.0/deed.de
#   (English) http://creativecommons.org/licenses/by-sa/3.0/
#
# In case of modifications you have to leave the original author name an email address in this header information and the source code!
#
#
# history:
#
# 04.01.2008:
#   - initial release
#
# 05.01.2008:
#   - extended with GTK gui
#
# 09.01.2009:
#   - added possibility to set guides procentually
#   - set plugin under CC-BY-SA license

import gimp
import gimpplugin
from gimpenums import *
pdb = gimp.pdb

import pygtk
pygtk.require("2.0")
import gtk
import re

class add_guides_plugin(gimpplugin.plugin):
    def query(self):
        gimp.install_procedure("add_multiple_guides",
                               "This plugin sets several pixel precision guides",
                               "", "Christian Nielebock", "Christian Nielebock",
                   "2008", "<Image>/Image/Guides/Setup Multiple Guides...", "", PLUGIN,
                   [(PDB_INT32, "run_mode", "Run mode"),(PDB_IMAGE,"image","Image"),(PDB_DRAWABLE,"drawable","Drawable")], [])

    def __init__(self):
        self.lines = 0
        self.tableX = 4
        self.tableY = 1
        self.theWindow = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.theWindow.set_title("Setup Multiple Guides")
        self.theWindow.set_resizable(False)
        self.theWindow.show()
        self.theWindow.connect("destroy",self.destroy)
        self.vbox = gtk.VBox(False,1)
        self.vbox.show()
        self.theWindow.add(self.vbox)
        self.mainTable = gtk.Table(self.tableY,self.tableX,True)
        self.mainTable.show()
        self.vbox.add(self.mainTable)
        self.hbuttonbox = gtk.HButtonBox()
        self.hbuttonbox.show()
        self.vbox.add(self.hbuttonbox)
   self.checkboxes = []
        self.labels = []
        self.entries = []
        self.combos = []
        self.theWindow.resize(200,50)

    def addline(self, widget):
        self.tableY+=1
        self.mainTable.resize(self.tableY,self.tableX)
        self.lines+=1

   # new Checkbox
   newcheck = gtk.CheckButton("Percentage?");
   newcheck.show()
   self.checkboxes.append(newcheck)

        # new Label
        newlabel = gtk.Label("Guideline " + str(self.lines))
        newlabel.show()
        self.labels.append(newlabel)

        # new Entry
        newentry = gtk.Entry(5)
        newentry.show()
        self.entries.append(newentry)   

        # new ComboBox
        newcombo = gtk.combo_box_new_text()
        newcombo.append_text("horizontal")
        newcombo.append_text("vertical")
        newcombo.set_active(0)
        newcombo.show()
        self.combos.append(newcombo)

   self.mainTable.attach(self.checkboxes[len(self.checkboxes)-1],0,1,self.tableY-2,self.tableY-1)
        self.mainTable.attach(self.labels[len(self.labels)-1],1,2,self.tableY-2,self.tableY-1)
        self.mainTable.attach(self.entries[len(self.entries)-1],2,3,self.tableY-2,self.tableY-1)
        self.mainTable.attach(self.combos[len(self.combos)-1],3,4,self.tableY-2,self.tableY-1)

    def delline(self,widget):
        if self.lines>1:
            self.lines-=1
       self.checkboxes[len(self.checkboxes)-1].destroy()
            self.combos[len(self.combos)-1].destroy()
            self.entries[len(self.entries)-1].destroy()
            self.labels[len(self.labels)-1].destroy()
       self.checkboxes.pop()
            self.combos.pop()
            self.entries.pop()
            self.labels.pop()
            self.tableY-=1
            self.mainTable.resize(self.tableY,self.tableX)
            self.theWindow.resize(300,100)

    def _checkstring(self,inputstring, chars):
        isok = True
        for x in range(len(inputstring)-1):
            if inputstring[x] not in chars:
                isok = False
        return isok

    def okbutton(self, widget):
        if self.lines>0:
            for a in range(self.lines):
                if self._checkstring(self.entries[a].get_text(),"0123456789"):
                    pos = int(self.entries[a].get_text())
                    hvtype = int(self.combos[a].get_active())
          procents = int(self.checkboxes[a].get_active())
                    if hvtype==0:
         if procents==True:
             if pos<0: pos=0
             if pos>100: pos=100
             pos = int(self.image.height * pos / 100)
            
         if pos<0: pos=0
         if pos>self.image.height: pos=self.image.height
                        self.image.add_hguide(pos)
                    else:
         if procents==True:
             if pos<0: pos=0
             if pos>100: pos=100
             pos = int(self.image.width * pos / 100)
            
         if pos<0: pos=0
         if pos>self.image.width: pos=self.image.width
              self.image.add_vguide(pos)
        gtk.main_quit()

    def quitbutton(self, widget):
        gtk.main_quit()

    def init_window(self):
        newbut0 = gtk.Button(None,gtk.STOCK_ADD)
        newbut0.connect("clicked",self.addline)
        newbut0.show()
        self.hbuttonbox.add(newbut0)
        newbut1 = gtk.Button(None,gtk.STOCK_REMOVE)
        newbut1.connect("clicked",self.delline)
        newbut1.show()
        self.hbuttonbox.add(newbut1)
        newbut2 = gtk.Button(None,gtk.STOCK_OK)
        newbut2.connect("clicked",self.okbutton)
        newbut2.show()
        self.hbuttonbox.add(newbut2)
        newbut3 = gtk.Button(None,gtk.STOCK_CANCEL)
        newbut3.connect("clicked",self.quitbutton)
        newbut3.show()
        self.hbuttonbox.add(newbut3)

    def add_multiple_guides(self,run_mode,image,drawable):
        self.image = image
        self.drawable = drawable
        self.init_window()
        self.addline(self.mainTable)
        gtk.main()

    def destroy(self, widget, data=None):
        gtk.main_quit()

if __name__ == "__main__":
    add_guides_plugin().start()

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 1:24 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Mar 23, 2012
Posts: 7316
Location: Göteborg at last!
Very useful. Thanks O and thanks Rod for the English version.


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 4:29 pm  (#11) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
My memory has caught up and I've remembered that I wrote another multiple guides script:
http://forum.meetthegimp.org/index.php/ ... ml#msg5863
This one is a little different as it adds guides one at a time but leaves the dialog box up for adding new guides as required.

Kevin


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 4:42 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Mar 23, 2012
Posts: 7316
Location: Göteborg at last!
Thanks for the translation O. Rod's version doesn't appear in my Gimp for some reason so that's helpful.

And thanks Kevin. I'll try yours as well.


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 5:03 pm  (#13) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Very nice Kevin, but I don't like having the new item, contributed, added to the Gimp image Menu. I can change it to where I want it. I love the plugin.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 5:15 pm  (#14) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Rod wrote:
Thanks O.
I fixed this one so it reads in English if anyone is interested.

Thanks Rod. Cool. And here I thought I was being continental by being able to use the German one. Of course, six months from now I probably will have forgotten what the German words mean. :hehe

I had to dump the German/English one as it made gimp hang when I booted gimp. The name was the same as Kevin's multiple guides one and I like Kevin's better.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 5:42 pm  (#15) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Erisian wrote:
Thanks for the translation O. Rod's version doesn't appear in my Gimp for some reason so that's helpful.

And thanks Kevin. I'll try yours as well.

Try this mod of Rod's English translated guide script. I tweaked it a bit because it didn't show up in my menu at first either.

(update)
"add_multiple_guides_plug_2.zip" was the original file uploaded by mistake.
"add_multiple_guides_plug_mod.zip" below is the new tweaked one.


Attachments:
add_multiple_guides_plug-mod.zip [2.05 KiB]
Downloaded 162 times

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)
Top
 Post subject: Re: Add Multiple Guides Plug-in
PostPosted: Sun Sep 16, 2012 6:03 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Mar 23, 2012
Posts: 7316
Location: Göteborg at last!
Thank you Odin.

Kevin - I quite like yours but I would prefer it if there was an option to use percentages. Sometimes I find that more helpful.


Top
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) add multiple guides

5

No new posts Attachment(s) SETUP MULTIPLE GUIDES

2

No new posts Guides from selection

2

No new posts Attachment(s) crosshair guides

8

No new posts Attachment(s) Guides [Solved]

8



* Login  



Powered by phpBB3 © phpBB Group