It is currently Sat Sep 12, 2026 6:31 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 3:47 pm  (#21) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12845
saulgoode wrote:
mahvin wrote:
Error: =: argument 1 must be: number


Try changing the following line:
(while (not (= old '()))

to:
(while (pair? old)


I tried this Saul, but still get this error after a long timeout (unlike Rod, it does show up on my version of GIMP 2.0; maybe since I do have gtk1x installed due to my installation of GIMP 1.2.4). Don't have feathersharpen (not sure it will work in GIMP 2.0; does work in GIMP 1.2.4), so just unchecked that option. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 3:56 pm  (#22) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16170
Actually after downloading the new version of texturetile i do get that same error now Lyle. :)
Even after changing the scm code.

_________________
Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 4:09 pm  (#23) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12845
Well, I finally did get Feathersharpen to show up by not only copying the dll you wanted earlier, but also libintl-1.dll. Still it gives me the error. Maybe Saul can figure out whatelse this Script-fu is expecting. Might be in the other While subroutine. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 4:43 pm  (#24) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16170
I got them all to show in the menus, but the scm gave that error and neither binary would run.So i replaced the old texturetile binary with the new one and deleted the sharpen feather binary.
I left the scm script installed, i figure like you i can just untick that value. :)
Now if we could just get the script to run :lol

_________________
Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 5:06 pm  (#25) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
lylejk wrote:
Well, I finally did get Feathersharpen to show up by not only copying the dll you wanted earlier, but also libintl-1.dll. Still it gives me the error. Maybe Saul can figure out whatelse this Script-fu is expecting. Might be in the other While subroutine. :)

Didn't see that one.
Substitute
(while (pair? point-list)

for
(while (not (= point-list nil))

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 5:16 pm  (#26) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12845
I'm getting to believe it's pretty much needs a complete revamp Saul. Anyway, now this is what I get. When I first run the Script-fu, I get this error:

Attachment:
first.png
first.png [ 27.21 KiB | Viewed 2109 times ]


Not doing anything else, when I re-run the Script-fu, I get this:


Attachments:
second.png
second.png [ 27.46 KiB | Viewed 2109 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Thu Mar 10, 2011 5:44 pm  (#27) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
Awesome! Works for me in Ubuntu, and what an awesome effect! Wow, I can see some interesting uses for this. Thanks, Saul.

This is totally different than the resynthesizer effect as it takes a square/rectangular sections from the original image and randomly creates a new image from it.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 7:45 am  (#28) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
mahvin wrote:
Awesome! Works for me in Ubuntu, and what an awesome effect! Wow, I can see some interesting uses for this. Thanks, Saul.

This is totally different than the resynthesizer effect as it takes a square/rectangular sections from the original image and randomly creates a new image from it.


what exactly work for you now?

could you post the script and explain what required ( as old libraries, texturizer oe what else) for the script to work properly

so i may do the same in ubuntu and try to adapt for xp or 7

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 10:41 am  (#29) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6946
Location: Somewhere in GIMP
After putting in saulgoode's changes, these are the error messages I got. After the top message, I changed the image to grayscale, then got the second message after running the script again. Using in Fedora Linux

Image

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


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 12:25 pm  (#30) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
@O ...
That is bad,it seems a nonsense for a similar script require images be in Grayscale .

@ Mahvin
So how is going for you ?
If works for you then we could make it works for others (including me and O ) but i would need to know your combination (not only the script but also the version of the plugin )

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:25 pm  (#31) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16170
All i did was replace those old parts of the code with what Saulgoode said and now mine works fine too. :)
Wow this thing is neat too.So fast. (i unticked feather by the way) that way it wont try and use the feather plugin.
old image-
Image

After running the filter for a 300x300 seamless textured pattern-
Image

; Patch-splat texture synthesis
; (Fast tilable texture synthesis script)

;    Copyright (C) 2003  Paul Francis Harrison

;    This program is free software; you can redistribute it and/or modify
;    it under the terms of the GNU General Public License as published by
;    the Free Software Foundation; either version 2 of the License, or
;    (at your option) any later version.

;    This program is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;    GNU General Public License for more details.

;    You should have received a copy of the GNU General Public License
;    along with this program; if not, write to the Free Software
;    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

; Copy a random rectangle to clipboard
(define (grab-patch img layer patch-size patch-border)
  (let*
    (
      (width    (car (gimp-drawable-width layer)))
      (height   (car (gimp-drawable-height layer)))
    )

    (gimp-rect-select img
      (+ patch-border (rand (- width  (* patch-border 2) patch-size)))
      (+ patch-border (rand (- height (* patch-border 2) patch-size)))
      patch-size patch-size 2 1 (* patch-border 2))
    (gimp-edit-copy layer)
  )
)

; Paste the clipboard and apply Sharpen Feathering
(define (put-patch img layer x y use-sharp)
  (let*
    (
      (floater (car (gimp-edit-paste layer FALSE)))
    )
    (gimp-layer-set-offsets floater x y)
    (if (= use-sharp TRUE) (plug-in-sharpfeather 1 img floater))
    (gimp-floating-sel-anchor floater)
  )
)

; Shuffle a list randomly (hacky)
(define (shuffle old)
  (let*
    (
      (new '())
    )

    (while (pair? old)
      (if (= (rand 2) 1)
        (set! new (cons (car old) new))
   (set! new (append new (list (car old))))
      )
      (set! old (cdr old))
    )

    new
  )
)

(define (script-fu-patch-synthesize img layer out-width out-height patch-proportion patch-feather-proportion use-sharp)
  (let*
    (
      (width     (car (gimp-drawable-width layer)))
      (height    (car (gimp-drawable-height layer)))
      (type      (car (gimp-drawable-type layer)))
      (base-type (car (gimp-image-base-type img)))
      (new-img   (car (gimp-image-new out-width out-height base-type)))
      (new-layer (car (gimp-layer-new new-img out-width out-height type "Background" 100 0)))

      (patch-size (* (min width height out-width out-height) patch-proportion 0.5))
      (patch-border (* patch-size patch-feather-proportion 0.25))
      (patch-jitter (/ patch-size 8))
      (patch-total  (+ patch-size patch-border patch-border))

      (xx 0)
      (yy 0)
      (old-selection 0)
      (point-list '())
    )

    (gimp-image-add-layer new-img new-layer 0)
    (gimp-edit-clear new-layer)
    (gimp-display-new new-img)
    (gimp-displays-flush)

    (gimp-image-undo-freeze img)
    (gimp-image-undo-disable new-img)

    (set! old-selection (car (gimp-selection-save img)))

    (while (< xx out-width)
      (set! yy 0)
      (while (< yy out-height)
        (set! point-list (cons (cons xx yy) point-list))
        (set! yy (+ yy (- patch-size patch-border patch-border patch-jitter)))
      )
      (set! xx (+ xx (- patch-size patch-border patch-border patch-jitter)))
    )

    (set! point-list (shuffle point-list))
    (set! point-list (shuffle point-list))
    (set! point-list (shuffle point-list))
    (set! point-list (shuffle point-list))

    (while (pair? point-list)
      (grab-patch img layer patch-size patch-border)

      (let*
   (
     (x (+ (caar point-list) (rand patch-jitter)))
     (y (+ (cdar point-list) (rand patch-jitter)))
   )

   (put-patch new-img new-layer x y use-sharp)
   (if (>= x (- out-width patch-total))
     (put-patch new-img new-layer (- x out-width) y use-sharp)
   )
   (if (>= y (- out-height patch-total))
     (put-patch new-img new-layer x (- y out-height) use-sharp)
   )
   (if
     (and
       (>= x (- out-width patch-total))
       (>= y (- out-height patch-total))
     )   
     (put-patch new-img new-layer (- x out-width) (- y out-height) use-sharp)
   )
      )

      (if (= (fmod (length point-list) 8) 7) (gimp-displays-flush))

      (set! point-list (cdr point-list))
    )

    (gimp-selection-load old-selection)
    (gimp-image-remove-channel img old-selection)
   
    (gimp-image-undo-enable new-img)
    (gimp-image-undo-thaw img)

    (gimp-displays-flush)
  )
)

(script-fu-register "script-fu-patch-synthesize"
                    "<Image>/Script-Fu/Render/Synthesize Texture..."
          "Create a tilable texture of arbitrary size from a sample, by simply copying random patches of the sample. The edges of each patch are disguised using the 'Sharpen Feathering' plug-in."
          "Paul Harrison ([email protected])"
          "Paul Harrison"
          "18/3/2003"
          "RGB GRAY"
          SF-IMAGE "Input Image" 0
          SF-DRAWABLE "Input Layer" 0
          SF-VALUE "Output width" "300"
          SF-VALUE "Output height" "300"
          SF-ADJUSTMENT "Patch size" '(0.6 0.1 1.0 0.01 0.1 1 0)
          SF-ADJUSTMENT "Patch feathering" '(0.5 0.0 1.0 0.01 0.1 1 0)
          SF-TOGGLE "Use feather sharpen" 1
)


You all know where to place the script ;)

_________________
Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:27 pm  (#32) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16170
You will find it under - Filters/Render/Synthesize Texture by the way

_________________
Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:29 pm  (#33) 
Offline
GimpChat Member
User avatar

Joined: Mar 02, 2011
Posts: 1850
Location: Michigan
Rod wrote:
You all know where to place the script ;)



Uh hate to be not part of the "all" but I honestly don't. And I did look in the first post and didn't see anything that would be for sure.

Should this run in 2.7 though?

_________________
Image
I'm back I think


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:43 pm  (#34) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16170
The script goes in the user/gimp-2.6/scripts folder Willy and i am not sure if 2.7.2 will run it.

_________________
Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:45 pm  (#35) 
Offline
GimpChat Member
User avatar

Joined: Mar 02, 2011
Posts: 1850
Location: Michigan
I'll test it and I should probably ask what to save as...
Sorry I am new to this stuff

_________________
Image
I'm back I think


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:47 pm  (#36) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16170
You can name it anything you want as long as it has a SCM file extension.

_________________
Image


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:50 pm  (#37) 
Offline
GimpChat Member
User avatar

Joined: Mar 02, 2011
Posts: 1850
Location: Michigan
Sorry about these dumb questions.
I went to that location and the script is just grayed out.

_________________
Image
I'm back I think


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 1:59 pm  (#38) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
I wonder why I didn't get the notices on PC's responses on this thread. Hmmmmm...

PC: My example would be nearly similar to Rod's. It just creates seamless tiled images by taking random rectangular snapshots of the original and applying it a new image.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 2:14 pm  (#39) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6946
Location: Somewhere in GIMP
Rod wrote:
All i did was replace those old parts of the code with what Saulgoode said and now mine works fine too. :)
Well Rod, I even copied and pasted your code into a new one. I get this error when I run it.

The script says this: "The edges of each patch are disguised using the 'Sharpen Feathering' plug-in." Is there a sharpen feathering plug-in somewhere?

Found this link: http://www.logarithmic.net/pfh/textureops

Image

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


Top
 Post subject: Re: Patchsynth.scm Help
PostPosted: Sun Apr 03, 2011 3:01 pm  (#40) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
Quote:
what exactly work for you now?

could you post the script and explain what required ( as old libraries, texturizer oe what else) for the script to work properly

so i may do the same in ubuntu and try to adapt for xp or 7


My original request for patchsynth.scm works for me now. I made the changes as saulgoode suggested and it worked in Ubuntu. I do not use Windows for much of anything except work and banking.

No additional libraries were needed for Ubuntu (that I am aware of).

The script is posted on the very first post. You can follow Saulgoode's comments to make the necessary changes. Or if you want, I can email you a copy of the updated script.

I downloaded the script from here:

http://www.logarithmic.net/pfh/textureops (textureops-0.3.tar.gz)

I compiled texturetiler.c and sharpfeather.c using gimptool (both worked after compiling)

patchsymth.scm fix suggestions by Saulgoode:

Try changing the following line:

(while (not (= old '()))

to:

(while (pair? old)

And:

Substitute

(while (pair? point-list)

for

(while (not (= point-list nil))

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group