It is currently Fri Apr 19, 2024 11:29 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 86 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 2:42 am  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
Thank you saulgoode for helping me with directions to finish this script.

1. make sure you have the latest version of the HatchSelectionLayer.scm <- found in the first post of that thread.

2. You should have an image open in RGB mode, the script will reduce the number of colors down to
same number of hatches (one hatch for each color), it will then convert your image back to RGB then does the auto-hatching for you. It will take some time.

Attachment:
AutoHatchLayers.scm [8.78 KiB]
Downloaded 279 times

Script will be found under Script-Fu->Create New->Auto Hatch Layers

UPDATED preview of the settings (changed to options between "Lines","Squares","Circles","All"
"All" will alternate through "Lines","Squares","Circles" as it does each hatch so you get a combined effect
Image
Here are some examples using the same image with different settings.
Image
Image
Image
Image
Image
Image

_________________
TinT


Last edited by trandoductin on Thu May 28, 2015 12:46 pm, edited 8 times in total.

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: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 3:20 am  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
The script currently's maximum number of hatches is 10...i didn't think i needed more but i guess with this image i used 30.. just updated the script maximum to be 255, but i doubt you'll need that many but if you do you can it might take a long while though if you do that many hatches.
test out with 5 and increase as needed.

Image

_________________
TinT


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 3:55 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
other prerequisites? I got:
Auto Hatch Layers Warning
Error while executing script-fu-auto-hatch:

Error: (<unknown> : 25099443) eval: unbound variable: script-fu-hatch-selection-layer

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 4:29 am  (#4) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2419
dinasset wrote:
other prerequisites? I got:
Auto Hatch Layers Warning
Error while executing script-fu-auto-hatch:

Error: (<unknown> : 25099443) eval: unbound variable: script-fu-hatch-selection-layer


this one from other thread:
1. make sure you have the latest version of the HatchSelectionLayer.scm found in the first post.

and in turn that has a requirement for the pattern set to clipboard.

_________________
Image


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 4:34 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
thanks Rich
I read that warning, but didn't understand it was referring to a DIFFERENT THREAD (normally referring to the "first post" is referring to the first post of the SAME thread which could become a multipage one, so....my fault, thanks!)

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 4:59 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
using 7 hatches, it never ends (or -better- it stops w/o any error on layer hatch #6)
I wait until the script is tested by someone else...

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 6:19 am  (#7) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2419
dinasset wrote:
using 7 hatches, it never ends (or -better- it stops w/o any error on layer hatch #6)
I wait until the script is tested by someone else...


I noticed that as well, I think it is the 255 value in line 104

Attachment:
hatch20.jpg
hatch20.jpg [ 187.04 KiB | Viewed 6601 times ]


@trandoductin
Just my opinion but the minimum value for"Hatch Grid Width and Height" (10, both scripts) is a bit 'coarse' for small images, maybe 5 as a starting value.

_________________
Image


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 6:48 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
I agree with Rich about the "minimum", I also like to get thinner lines.
I succeeded in getting an output, but I was obliged to create my own version of the script removing the undo capability otherwise it always crashes because of space usage -in my PC- on images of nowadays "common" size

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 8:53 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
Just tested it. Only bug that I see is when you first run it (just after opening GIMP). It chooses the default background pattern for whatever reason. Changing that to the Clipboard pattern fixes all (same issue with your original script; strange). No biggy though. Thanks Tran and all that helped with this one. I did do a test (not showing; not a good image) and it was pretty cool. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:15 am  (#10) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
@Tin:
To get around the problem of the user having to pre-select the Clipboard pattern, use this trick by Rob-A:
(gimp-context-set-pattern (list-ref (cadr (gimp-patterns-get-list "")) 0))

This just extracts the first name from the list of patterns - which is always the Clipboard.

[Using the above code is better than (gimp-context-set-pattern "Clipboard") because the actual name of the clipboard pattern is locale-dependent. Rob-A's trick will work for all locales.]

BTW
I notice that you're not saving the caller's context in either script.
I think the first script (HatchSelectionLayer-x.scm) could really do with:
  (gimp-context-push)
  (gimp-image-undo-group-start image)                   ;undo-group in one step
    :
    :
    :
  (gimp-image-undo-group-end image)                     ;undo group in one step
  (gimp-context-pop)
  (gimp-displays-flush)


Last edited by jontait2 on Wed May 27, 2015 9:31 am, edited 1 time in total.

Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:30 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
the outcome using defaults as shown
Attachment:
Screenshot 2015-05-27 16.30.43.png
Screenshot 2015-05-27 16.30.43.png [ 1.13 MiB | Viewed 1371 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:35 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
...and setting ON "Hatch With Rectangle"
Attachment:
Screenshot 2015-05-27 16.37.08.png
Screenshot 2015-05-27 16.37.08.png [ 2.32 MiB | Viewed 1370 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:37 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
jontait2 wrote:
@Tin:
To get around the problem of the user having to pre-select the Clipboard pattern, use this trick by Rob-A:
(gimp-context-set-pattern (list-ref (cadr (gimp-patterns-get-list "")) 0))

This just extracts the first name from the list of patterns - which is always the Clipboard.

[Using the above code is better than (gimp-context-set-pattern "Clipboard") because the actual name of the clipboard pattern is locale-dependent. Rob-A's trick will work for all locales.]

BTW
I notice that you're not saving the caller's context in either script.
I think the first script (HatchSelectionLayer-x.scm) could really do with:
  (gimp-context-push)
  (gimp-image-undo-group-start image)                   ;undo-group in one step
    :
    :
    :
  (gimp-image-undo-group-end image)                     ;undo group in one step
  (gimp-context-pop)
  (gimp-displays-flush)


Just entered this in the beginning of the Auto version and it works great jontait; thanks for the info and here's RobA to the rescue again. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:45 am  (#14) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
Thanks JT.
I updated the 1st script to push context and set it to use clipboard pattern.
And also changed both scripts to have minimum gridwidth/height of 5 (default is still 10 but you can set it to 5).

_________________
TinT


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:48 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
using a better source image
Attachment:
971134195-hatched.jpg
971134195-hatched.jpg [ 1.74 MiB | Viewed 1367 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 9:57 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
trandoductin wrote:
Thanks JT.
I updated the 1st script to push context and set it to use clipboard pattern.
And also changed both scripts to have minimum gridwidth/height of 5 (default is still 10 but you can set it to 5).


You made me update again Tran. lol

Everything works now. Just one more request (but could be complicated so not necessary). It would be cool to combine both straight and square options within the same render. Say, pick the square for the mid or low level colors for instance. Not sure if this would make the Script way too complicated or not. Still, thanks again Tran and all that got this one working. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 10:26 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
Suppose I should share a result. Need to find a better subject. :)


Attachments:
L1000147b.png
L1000147b.png [ 3.15 MiB | Viewed 1358 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 10:26 am  (#18) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
lylejk

update your script.

I added an extra toggle called "Combine Rectangles and Lines" and it'll do rectangles for darker colors
about half of the colors ...so if you did like 6 colors 3 darker colors will be rectangles and 3 will be lines.
if you do 5 colors (I think it 5> 2.5, 4>2.5, 3> 2.5 so i'll do 3 colors in rectangles and 2 brighter will be in lines).

_________________
TinT


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 10:34 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Tin, one question:
if I look to the various areas of the last image I posted, I notice that in one area (attached) the stripes are made with different nuances; is this wanted?
Attachment:
only-one-colour.png
only-one-colour.png [ 34.28 KiB | Viewed 1354 times ]


(what looks white is transparent)

_________________
"Where am I ?"


Top
 Post subject: Re: Auto Hatch Layers (will hatch your whole image)
PostPosted: Wed May 27, 2015 10:37 am  (#20) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
dinasset,
i am not sure i understand your question.

Oh I see what you mean, I am not sure why that is, it's a repeated pattern so it shouldn't have different shades, i am not sure but if i had to guess i'd say it's probably computers trying to show patterns that aren't viewed at 100%. But I really have no clue at all.

_________________
TinT


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

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Hatch Patterns

2

No new posts Attachment(s) ( solved) dimensions of the image on several linked layers

4

No new posts Auto Installer

7

No new posts Retexture an image with another image as "Image Pattern" Plug-in

4

No new posts GIMP XCF image plug-in could not open image; File is Not 0 Bytes

4


cron

* Login  



Powered by phpBB3 © phpBB Group