GIMP Chat
http://gimpchat.com/

Add Multiple Guides Plug-in
http://gimpchat.com/viewtopic.php?f=9&t=5281
Page 1 of 1

Author:  Oregonian [ Sun Sep 16, 2012 10:31 am ]
Post subject:  Add Multiple Guides Plug-in

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

Author:  molly [ Sun Sep 16, 2012 10:37 am ]
Post subject:  Re: Add Multiple Guides Plug-in

Thank you O

Author:  AnMal [ Sun Sep 16, 2012 11:13 am ]
Post subject:  Re: Add Multiple Guides Plug-in

thank you, O! very useful, it takes so much time to add the guides one by one.

Author:  paynekj [ Sun Sep 16, 2012 11:16 am ]
Post subject:  Re: Add Multiple Guides Plug-in

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

Author:  Oregonian [ Sun Sep 16, 2012 11:48 am ]
Post subject:  Re: Add Multiple Guides Plug-in

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:

Author:  molly [ Sun Sep 16, 2012 11:55 am ]
Post subject:  Re: Add Multiple Guides Plug-in

thanks Kevin, got it in favorites.

Author:  he4rty [ Sun Sep 16, 2012 12:17 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

Thanks for the Link Kevin, some very handy guide thingy's in there.

Author:  Odinbc [ Sun Sep 16, 2012 12:21 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

This ones pretty good, Grid of Guides.
http://registry.gimp.org/node/12003

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

Author:  Rod [ Sun Sep 16, 2012 12:23 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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()

Author:  Erisian [ Sun Sep 16, 2012 1:24 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

Very useful. Thanks O and thanks Rod for the English version.

Author:  paynekj [ Sun Sep 16, 2012 4:29 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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

Author:  Erisian [ Sun Sep 16, 2012 4:42 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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.

Author:  Oregonian [ Sun Sep 16, 2012 5:03 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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

Author:  Oregonian [ Sun Sep 16, 2012 5:15 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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.

Author:  Odinbc [ Sun Sep 16, 2012 5:42 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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

Author:  Erisian [ Sun Sep 16, 2012 6:03 pm ]
Post subject:  Re: Add Multiple Guides Plug-in

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.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/