It is currently Sun Apr 28, 2024 3:05 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 20 posts ] 
Author Message
 Post subject: Create Ofn-tartan (with preview).
PostPosted: Wed Jul 14, 2021 2:14 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
He's been experimenting with fu_preview a bit lately.
viewtopic.php?f=9&t=19420
I had to try ofn-tartan.py as well
Can be downloaded for testing from:
https://www.gimpscripts.net/2021/07/cre ... eview.html


Attachments:
Tartan4.jpg
Tartan4.jpg [ 128.04 KiB | Viewed 8254 times ]
For French friends .jpg
For French friends .jpg [ 237.87 KiB | Viewed 8254 times ]

_________________
Image

Slava
Ukraini!
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: Create Ofn-tartan (with preview).
PostPosted: Thu Jul 15, 2021 9:45 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12518
Nice tartan, Mario. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Thu Jul 15, 2021 5:59 pm  (#3) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13017
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
MareroQ wrote:
He's been experimenting with fu_preview a bit lately.
viewtopic.php?f=9&t=19420
I had to try ofn-tartan.py as well
Can be downloaded for testing from:
https://www.gimpscripts.net/2021/07/cre ... eview.html

Thanks Mario for sharing this with us!
:jumpclap

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Thu Jul 15, 2021 9:37 pm  (#4) 
Offline
Global Moderator
User avatar

Joined: Oct 02, 2014
Posts: 4423
Location: Sydney Australia
Thanks for this one MareroQ; blue and green should never be seen with no other colour in between ... except in Scottish and Irish tartans.

Don't blame me , blame 'lock down' :gaah


Attachments:
tartan_meisje.png
tartan_meisje.png [ 697.39 KiB | Viewed 8088 times ]

_________________
Image

Respect should be offered freely but hard earned
Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Fri Jul 16, 2021 11:36 pm  (#5) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7716
Location: On the other side of this screen
How's this?
Image
Thank you everyone who was involved in creating this plugin.

Have been told the same thing about red and green but it is everywhere in nature.

_________________


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Sat Jul 17, 2021 5:14 am  (#6) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7716
Location: On the other side of this screen
For Wallace
Image

_________________


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Sat Jul 17, 2021 11:19 am  (#7) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
By copying my code (which is OK), you implicitly abide to the license (GPLv3, as stated). and this licence says:

Quote:
5. Conveying Modified Source Versions.

You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:

a) The work must carry prominent notices stating that you modified it, and giving a relevant date.


This means that the registration code should bear your copyright, and not mine ("author" and "year" variables).

_________________
Image


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Sun Jul 18, 2021 9:08 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
The code contains all the information (in History).
However, Your suggestion was taken into account.

Some changes in the newer version 0.4 (I'm testing PF_TAB in gimpfu by code arakne):


Attachments:
Ver 0.4.jpg
Ver 0.4.jpg [ 144.08 KiB | Viewed 7417 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Tue Nov 23, 2021 2:36 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
It was interesting for me.

Clan MacLeod Tartan Patterns

My answer - Ver. 0.5
https://www.gimpscripts.net/2021/07/cre ... eview.html

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Wed Nov 24, 2021 12:27 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 774
Location: SEA - South East Asia
MareroQ wrote:

That's an excellent answer, script with preview are awesome :clap

If I may, IMHO there is few slight problems (tiny- very tiny :mrgreen: ) or place for improvement?
1 The number of colors/thread are hard coded to 6, thus we cannot do the MacLeod of Harris aka Macleod hunter, where the symmetrical threadcount "R6K4G30K20BL40K4Y8" is made out of 7 different threadcount/colors...
You don't want to put more than 6 choices, or the UI will become ugly, but IMVHO what could be nice is to add a button "Add" and a button "Remove" a bit like the plugin about adding multiple guides (I copy/paste the code if you ever want to look at it, as GC seems to not take in count .py)
#!/usr/bin/env python

#
# 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
# Download http://gimpchat.com/viewtopic.php?f=11&t=19518

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

Attachment:
screenshot_20211124-123913.png
screenshot_20211124-123913.png [ 170.26 KiB | Viewed 1976 times ]


2 I found a little bug (it's a tiny one :bigthup ) when creating inside a selection, the first pattern (some time and depending the shape of the selection) got a strange behavior, see the difference between the green square and the red square
Attachment:
screenshot_20211124-124222.png
screenshot_20211124-124222.png [ 81.1 KiB | Viewed 1976 times ]


EDIT (bugs):
2 more bugs
a) it does not add the 6th color
Image

b) Also past a certain number, it give this
Note: "Render Tartan" is "Yes" on the second tab, if "Render Tartan" is "Don't use" it will not give the alert/error.
Image

3 There is not Ctrl+Z (undo) once generated, thus history is "broken", as an example if I use a script from Skinnyhouse which generate 100s of layers (Custom Font Layers from Font), and I'm not happy with the font, I just Ctrl+Z and it works fine, everything gets back as it was before to run the script.

Having said all that, there is no doubt in my mind that your plugin with a preview window is a huge improvement for us the users, I love it, I love the tabs, It's a pleasure to use it!
Thanks a lot MareroQ for this important improvement which allow us to SEE what we are doing :clap :jumpclap :coolthup .

_________________
Patrice


Last edited by PixLab on Wed Nov 24, 2021 2:35 am, edited 1 time in total.

Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Wed Nov 24, 2021 2:31 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 774
Location: SEA - South East Asia
If it can help you debug, after my post #10, and with further "investigation", depending "Yes" or "Don't use" on the second tab it takes or does not take in count the 6th color

Image

Image

No purple color
Image

_________________
Patrice


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Wed Nov 24, 2021 3:43 am  (#12) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
IMHO a better UI would be to just take the usual tartan notation and work from that. With the nice side effect that once you have your dream tartan, you can keep its secret formula in a simple text file.

_________________
Image


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Wed Nov 24, 2021 6:31 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
Thanks for the comments and tips.
However, the criticism is more inspiring (but there are 7 colors - the background for the repeating color).
Once on this forum I read that for the Phyton code:
- preview -No,
- tabs -No,
- load settings - No.
Now it is possible for me (without knowing gtk) and very simple.
Just some time - to think about what the next version should be.

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Fri Nov 26, 2021 1:13 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
It's so obvious I've made a serious mistake (and all limitations are described by Ofnuts in the help file :gaah ).
Everything has to be square based (with an even side length ) - so for now I have quickly changed the allowed START - END values to even values (ver.0.6).
Sorry for my incompetence. :oops:


Attachments:
Help excerpt ofn-tartan html.png
Help excerpt ofn-tartan html.png [ 53.98 KiB | Viewed 1714 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Fri Nov 26, 2021 2:14 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: May 24, 2021
Posts: 774
Location: SEA - South East Asia
MareroQ wrote:
It's so obvious I've made a serious mistake (and all limitations are described by Ofnuts in the help file :gaah ).
Everything has to be square based (with an even side length ) - so for now I have quickly changed the allowed START - END values to even values (ver.0.6).
Sorry for my incompetence. :oops:


I would love to have your "incompetence" :bigthup
Very nice fix MareroQ, it now works like a charm, the transparency as well :clap :jumpclap

Attachment:
screenshot_20211126-150556.png
screenshot_20211126-150556.png [ 53.66 KiB | Viewed 1701 times ]

Attachment:
screenshot_20211126-151317.png
screenshot_20211126-151317.png [ 55.06 KiB | Viewed 1701 times ]


This is a very beautiful plugin, thanks A LOT :hi5

_________________
Patrice


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Fri Nov 26, 2021 3:22 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
@MareroQ:
I've noticed you have prepared the script for translation.
Where would I have to place the translation file and what name should it have.

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Fri Dec 03, 2021 9:19 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
Sorry for late reply.
The plug is not yet prepared for translation (gimfu3 looks so strange).
I can do it when they are interested (and there will be several presets to load).

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Thu Dec 16, 2021 9:47 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
I have a problem with the plugin: It doesn't render the tartan but instead uses the active pattern.
I've recorded a little video to illustrate.
https://u.pcloud.link/publink/show?code ... 0VfQrLozn7
As you can see I start a new image, give it some colour, start the script, do the settings on the second tab only,
-- and it doesn't show the tartan. My fault? Should I do something else?

Also there is some output when starting GIMP in warn-mode (don't know if it's relevant):
gimp --pdb-compat-mode=warn


(/home/xxx/.config/GIMP/2.10/plug-ins/Create Ofn-tartan with preview_tab.py:6238): LibGimp-CRITICAL **: 15:33:46.911: gimp_drawable_preview_set_drawable_id: assertion 'priv->drawable_ID < 1' failed
using gegl copy
using gegl copy
using gegl copy
using gegl copy
using gegl copy
using gegl copy
using gegl copy
using gegl copy
using gegl copy
using gegl copy


GIMP 2.10.28 PPA installation on Linux Mint MATE 20.1

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Thu Dec 16, 2021 7:04 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2248
Location: Poland
Hi Nelo.

Thanks for reporting.
One line of code was lost during the corrections. :oops:
I also noticed information about an outdated procedure in Your video (pdb.gimp_image_add_layer - fixed on pdb.gimp_image_insert_layer).
LibGimp-CRITICAL messages are probably a "typical" gegl bug (this plugin doesn't use any Gegl operation).
Try Ver 0.7.
:crash
Greetings.

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Create Ofn-tartan (with preview).
PostPosted: Fri Dec 17, 2021 3:13 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
That's much better now. Thanks for fixing, MareroQ :tyspin

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
Post new topic Reply to topic  [ 20 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Brush does not look like Preview.

2

No new posts Attachment(s) Symetrize with LIVE PREVIEW

5

No new posts Attachment(s) Distort with LIVE PREVIEW

5

No new posts Attachment(s) Gimpressionist - Big Preview for Gimp-2.10.20

17

No new posts Attachment(s) AutoTrace with LIVE PREVIEW

14



* Login  



Powered by phpBB3 © phpBB Group