It is currently Fri Apr 26, 2024 10:34 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Rasterize script Rel2
PostPosted: Fri Dec 21, 2012 11:41 pm  (#1) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
The Rasterize will give a similiar result as the gmic filter ' Tiled parametrization' as shown in the Images below

; Rel 0.02 - Changed script to call 'gimp-drawable-mask-intersect' so as to correctly determine if a selection is affecting the drawable

Original Image

Image

After Rasterize

Image

Image

Image

Rasterize with a selection active

Image

Menu location is Filters/Blur

Rel2 is below↓

Attachment:
Rasterize.scm [4.33 KiB]
Downloaded 246 times

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Last edited by Graechan on Tue Dec 25, 2012 2:31 am, edited 3 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: Rasterize script
PostPosted: Sat Dec 22, 2012 12:22 am  (#2) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Nicely written. A couple of quick comments. First, since your script raises a dialog, there should be ellipses following the command in the menu ("Rasterize..."). Second, when you calculate your selection bounds (x1,y1,x2, and y2), you should take into account the boundaries of the drawable (perhaps using 'gimp-drawable-mask-intersect' or 'gimp-drawable-mask-bounds').

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Rasterize script
PostPosted: Sat Dec 22, 2012 1:10 am  (#3) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Saulgoode I'm a bit lost here do you mean like this for part 1 and if not could you post a possible change for it and part 2

Saulgoode is what you have stated in part 1 a naming convention that I have not used through ignorance and if so thank you for the heads up.

EDIT I now understand part 2 as the drawable may not be same size as image I've changed to use 'gimp-drawable-mask-bounds'

(script-fu-register "script-fu-rasterize-selection"
                    "Rasterize..."
                    "Makes the active Selection or Image look \"blocky\"."
                    "Graechan"
                    "Graechan - http://gimpchat.com"
                    "Dec 2012"
                    "RGB* GRAY*"
                    SF-IMAGE "Image" 0
                    SF-DRAWABLE "Drawable" 0
                    SF-ADJUSTMENT "Size of blocks" '(20 5 100 1 5 0 0)
               SF-ADJUSTMENT "Blurfactor" '(2 1 10 1 5 0 0)
                    SF-TOGGLE     "Keep selection"    FALSE
               )
(script-fu-menu-register "script-fu-rasterize-selection" "<Image>/Filters/Blur/")

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Rasterize script
PostPosted: Sat Dec 22, 2012 4:14 am  (#4) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Graechan wrote:
Saulgoode is what you have stated in part 1 a naming convention that I have not used through ignorance and if so thank you for the heads up.

Yes, it is merely a matter of convention, and let's the user know whether the command will present a dialog expecting further input.

Also as a minor point with regard to convention, the pop-up blurb for a command should describe what running the command will do, not what the command does. For example, your Rasterize command will "Make the active Selection or Image look blocky" (not "Makes the ..."). This is admittedly a bit nit-picky but for consistency your script should strive to follow the same convention as used throughout the rest of the GIMP menus.

Graechan wrote:
I now understand part 2 as the drawable may not be same size as image I've changed to use 'gimp-drawable-mask-bounds'

A word of caution on 'gimp-drawable-mask-bounds', the first value returned will be TRUE if there is selection and that selected region does not overlap the layer. In this situation, the coordinates returned will be the boundaries of the layer (relative to the layer). Unless you test for this condition, your script may wrongly assume the entire layer is selected even if none of it is.

This behavior of 'gimp-drawable-mask-bounds' was considered to be a bug, but it was not discovered until it was too late (and fixing it would have broken too many existing scripts). The developers chose to introduce a new procedure, 'gimp-drawable-mask-intersect', which returns FALSE if there is a selection but that selection does not overlap the layer. In general, 'gimp-drawable-mask-intersect' is preferable (note, however, that it returns the selection's width and height, not the lower and right boundary).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Rasterize script
PostPosted: Sat Dec 22, 2012 11:25 am  (#5) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Interesting and pleasant results. I made the blocks 50 and the blur factor 1. Thanks for the new script, Graechan!

Image

Original image here.

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


Top
 Post subject: Re: Rasterize script
PostPosted: Sat Dec 22, 2012 5:45 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thank you 'O' the script is still in development as I am still trying to get all the procedure calls correct with the invaluable help from Saulgoode

I am positive I'll get there soon

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Rasterize script Rel2
PostPosted: Tue Dec 25, 2012 1:49 am  (#7) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
I have updated script to Rel2 so as to improve the drawable location method and whether it's affected by a selection,

it's now greatly improved thanks to Saul Goode :bigthup :tyspin

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Rasterize script Rel2
PostPosted: Tue Dec 25, 2012 4:07 am  (#8) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Thank's for the update Graechan, can I say your a kamikaze; in a good way? It's either that or your like the Energizer Bunny, you keep going and going until it's the best :bigthup

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


Top
 Post subject: Re: Rasterize script Rel2
PostPosted: Tue Dec 25, 2012 5:42 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thank you Odin I Just like scripts without bugs of any type and some of Gimps PDB calls come with strange behaviors that only become evident once you use them in a script, when Salgoode comes back from his break he is going to write a description on the PDB calls I've worked with.

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Looking for Script Coder to make Script of my VHS effect

2

No new posts Attachment(s) Cannot run test script-fu script via console

7

No new posts Attachment(s) A liitle Start Help with a Script-Fu Script

3

No new posts Attachment(s) Script-fu

6

No new posts Attachment(s) Making Art from Script

4



* Login  



Powered by phpBB3 © phpBB Group