It is currently Tue Aug 25, 2026 5:26 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Rotate layer in script
PostPosted: Tue Aug 28, 2018 10:01 pm  (#1) 
Offline
GimpChat Member

Joined: Sep 17, 2016
Posts: 13
Location: Parksville, BC, Canada
Hello Everyone: I am new to Gimp scripts and I am writing a Python script in which one of the steps is to rotate a layer by 10 degrees. If I rotate the layer in Gimp using the Rotate tool, specifying an angle of 10 produces the desired result i.e. the layer is rotated clockwise by 10 degrees. However, I cannot duplicate this using the pdb.gimp_item_transform_rotate procedure - specifying an angle of 10 rotates the layer somewhere around 220 degrees.

What am I doing wrong?

Thanks. . .

Tony N.


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: Rotate layer in script
PostPosted: Tue Aug 28, 2018 11:47 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
angle1 = 10.0
rotation = (angle1/180.0)*3.14159 #converting to radians
rotated1 = pdb.gimp_item_transform_rotate(Drawable, rotation, True, Drawable.width/2, Drawable.height/2)

_________________
"Where am I ?"


Top
 Post subject: Re: Rotate layer in script
PostPosted: Wed Aug 29, 2018 1:39 am  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
dinasset wrote:
angle1 = 10.0
rotation = (angle1/180.0)*3.14159 #converting to radians
rotated1 = pdb.gimp_item_transform_rotate(Drawable, rotation, True, Drawable.width/2, Drawable.height/2)

math.pi is better than 3.14159

_________________
Image


Top
 Post subject: Re: Rotate layer in script
PostPosted: Wed Aug 29, 2018 6:33 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Thanks Ofnuts.

_________________
"Where am I ?"


Top
 Post subject: Re: Rotate layer in script
PostPosted: Wed Aug 29, 2018 9:29 am  (#5) 
Offline
GimpChat Member

Joined: Sep 17, 2016
Posts: 13
Location: Parksville, BC, Canada
dinasset, ofnuts: Yes, that worked - thanks so much.

Regards. . .

Tony N.


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group