The "Meet the GiMP!" ForumGiMP, Image Processing (DIP) and PhotographyImage Processing SoftwareScripts, Python, Perl and SchemeLayer rotation (WAS: Problem registering python script)
Pages: [1]   Go Down
Print
Author Topic: Layer rotation (WAS: Problem registering python script)  (Read 730 times)
w_nightshade
Regular
**
Posts: 43



View Profile WWW
« on: October 11, 2008, 08:38:49 pm »

I am trying to write a python script to automate a task I do a lot - taking an image layer and creating rotated copies of that layer to make an animated GIF.  I had a very nice person write me a scheme script once, because scheme makes my eyes itch, but python looked like something I could get my head around (I certainly find it more readable...).  I decided to port that script-fu file into python.

Anyway, I built a shell that doesn't really do anything so I could test the registration/installation before actually getting it to do any heavy work.  BUt I cannot get it to show up in GIMP.  I copied & modified the registration statement from the Meaningful Black script (which installed and works just fine), but I cannot get it to work. 

I attach my script shell for examination.  Can anyone tell me what (most likely simple) error I am making?  Is there any syntax that must be followed to get the script to properly register?

Again, I am putting it in the right plug-ins directory, I have another .py file working, and copied that registration statement, but no luck.  Help!

* python-fu-ambigram-rotation.py (2.45 KB - downloaded 44 times.)
« Last Edit: October 20, 2008, 01:51:03 pm by w_nightshade » Logged

ray adagio
Just in
*
Posts: 17


View Profile WWW
« Reply #1 on: October 12, 2008, 11:34:44 am »

Hi w_nightshade,

I changed the syntax in the registration part and the undo-group-commands. The attached script is now successfully registered. I don't know what's wrong with your if-else condition. I'm still a beginner in python.

regards,
Bert

* python-fu-ambigram-rotation.py (1.55 KB - downloaded 25 times.)
« Last Edit: October 12, 2008, 11:49:16 am by ray adagio » Logged

w_nightshade
Regular
**
Posts: 43



View Profile WWW
« Reply #2 on: October 12, 2008, 08:44:02 pm »

Outstanding!

I don't know what's wrong with your if-else condition. I'm still a beginner in python.

I don't think anything is wrong with it... it doesn't actually do anything yet.  Grin  In any case, a thousand thank-yous.
Logged

w_nightshade
Regular
**
Posts: 43



View Profile WWW
« Reply #3 on: October 13, 2008, 02:27:55 pm »

I have modified a Scheme script someone wrote to take a layer of an image, copy and rotate it, merge it with copies of the background, & rename with frame delays.  The resultant image (if you start with two layers) should be suitable for saving as an animated GIF which rotates either 180 or 360 degrees as specified, after a specified delay.

Please test, use, enjoy!

EDIT: old version removed
« Last Edit: October 14, 2008, 10:41:38 pm by w_nightshade » Logged

w_nightshade
Regular
**
Posts: 43



View Profile WWW
« Reply #4 on: October 14, 2008, 10:42:50 pm »

So I ran into a bug in this script. It seems the image I was testing with was not robust enough, and a "real world" example crapped it out.  I updated the method I was using to get the Background layer, and it should work fine now.
« Last Edit: October 16, 2008, 04:43:39 pm by w_nightshade » Logged

w_nightshade
Regular
**
Posts: 43



View Profile WWW
« Reply #5 on: October 16, 2008, 04:44:57 pm »

OK, one more pass: I am trying to break my reliance on the PDB so I updated the script to use more python-like object method and property calls.

* python-fu-layer-rotation.py (4.01 KB - downloaded 17 times.)
Logged

Rolf
Administrator
Lives here ;-)
***
Posts: 306


View Profile
« Reply #6 on: October 16, 2008, 08:41:25 pm »

What is the advantage of not relying on the pdb? (I haven't looked at the code up to now....)
Logged

w_nightshade
Regular
**
Posts: 43



View Profile WWW
« Reply #7 on: October 16, 2008, 08:52:39 pm »

Advantage?  Mostly less typing in code. Cheesy

myLayer = pdb.gimp_image_get_active_layer(myImage)

becomes

myLayer = myImage.active_layer

Stuff like that.  Coding it is easier - there is no advantage to you good people downloading and using the script.
Logged

Rolf
Administrator
Lives here ;-)
***
Posts: 306


View Profile
« Reply #8 on: October 18, 2008, 10:11:00 pm »

Your way is more object oriented and better to read, isn't it?

I'll look at your code when I have my system back up and Tuesdays show recorded. Real live is just interfering in a nice way........
Logged

Pages: [1]   Go Up
Print
Jump to: