It is currently Thu Jul 04, 2024 4:38 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 5:19 am  (#21) 
Offline
GimpChat Member
User avatar

Joined: Jun 02, 2013
Posts: 2075
I did have a png file in my folder. It was a sample image that came with gradients I had downloaded. I put the new file in, but can't access the feature. Do you right click the gradients in the drop down menu for gradients? If so, that doesn't work for me. Thanks.

_________________
Image


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 5:20 am  (#22) 
Offline
GimpChat Member
User avatar

Joined: Jun 02, 2013
Posts: 2075
Never mind, I figured it out.

_________________
Image


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 8:02 am  (#23) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Thanks Tran. A very handy utility addition to GIMP! :)
Creates new gradients and edits those fine.

When i try and open one i did in the text editor it errors.

Image

Here is the code inside

<defs>
<linearGradient id="SVG myWhiteToBlueGrad">
<stop offset="0%" stop-color="#FFFFFF" />
<stop offset="100%" stop-color="#000ac3" />
</linearGradient>
</defs>


Do you think it has to do with the svg and rectangle tags? Because i noticed the new gradients contain that also.

<svg width="640" height="480" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="SVG TEST_RD">
<stop offset="0%" stop-color="#000000" stop-opacity="1.0" />
<stop offset="50%" stop-color="#ff0000" stop-opacity="1.0" />
<stop offset="100%" stop-color="#ffffff" stop-opacity="1.0" />
</linearGradient>
</defs>
<rect x="0" y="0" width="640" height="480" fill="url(#SVG TEST_RD)"/>
</svg>

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 8:05 am  (#24) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Never mind i figured it out. My gradients have been saved as different names than what the code contains.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 8:29 am  (#25) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Also i had to change SF-SLIDER to SF-SPINNER i believe because i use the gimp-fu that creates columns instead of a scroll-bar it effected this function. It gets stuck on 100%. :lol

Image

Works beautifully now. :bigthup

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 9:34 am  (#26) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
I can't seem to edit them in GIMP, which is a pain in the butt. Is there an editor elsewhere or standalone?

Microsoft has a development gradient editor for Edge online, useful, but not what I was looking for:

https://developer.microsoft.com/en-us/m ... oundmaker/

If I make a copy of the gradient, then I can edit it. Weird, it would be nice if ANY gradient (CSS, SVG ,etc.) could be edited within GIMP.

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


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 10:13 am  (#27) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
mahvin wrote:
I can't seem to edit them in GIMP, which is a pain in the butt. Is there an editor elsewhere or standalone?

Microsoft has a development gradient editor for Edge online, useful, but not what I was looking for:

https://developer.microsoft.com/en-us/m ... oundmaker/

If I make a copy of the gradient, then I can edit it. Weird, it would be nice if ANY gradient (CSS, SVG ,etc.) could be edited within GIMP.


Have you made sure you've named the gradient file the same as inside the code.

Oh you mean in GIMPs editor.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 10:19 am  (#28) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
Yeah, it seems if the file isn't made natively within GIMP those features are null. Making a copy made it native so therefore GIMP lets you play with it. Developers got too many things on their plates for me to ask for yet another feature, so I'll just make do with copying for now.

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


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 10:57 am  (#29) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
dinasset wrote:
thanks Tin
Just to inform you - because all my resources are maintaned in subfolder - I added in your filter for myself the subfolder name
SVG\\
after Gradients\\ in the explicit filenames
if you will consider in a next release to allow a subfolder, it would be great IMO

For the problem indicated by Rich maybe you may use the python function-expression
os.path.join() which can be used in conjunction with os.path.sep()


I am not sure what you mean... or how i would use those functions.
here's my code where it expands the user's home directory (at least for windows).
dirname = "~\\.gimp-2.8\\gradients\\"
   dirname = os.path.expanduser(dirname)

_________________
TinT


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 1:17 pm  (#30) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
@rich2005 or anyone else on Linux:
Can you try release 7 (in post #1) and let me know if the forward slashes change work in Linux.
I am on Windows and after this change it still works on Windows, so hopefully it solved the Linux problem.

_________________
TinT


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 1:29 pm  (#31) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
trandoductin wrote:
dinasset wrote:
thanks Tin
Just to inform you - because all my resources are maintaned in subfolder - I added in your filter for myself the subfolder name
SVG\\
after Gradients\\ in the explicit filenames
if you will consider in a next release to allow a subfolder, it would be great IMO

For the problem indicated by Rich maybe you may use the python function-expression
os.path.join() which can be used in conjunction with os.path.sep()


I am not sure what you mean... or how i would use those functions.
here's my code where it expands the user's home directory (at least for windows).
dirname = "~\\.gimp-2.8\\gradients\\"
   dirname = os.path.expanduser(dirname)

example taken from one filter:
import os.path
...
...
newfile_fullname = os.path.join (dir_name, newfile_name + file_ext)

_________________
"Where am I ?"


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 1:31 pm  (#32) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
using os.path.join you are not obliged to hardcode slashes which are different from one os to another

_________________
"Where am I ?"


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 1:37 pm  (#33) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2438
trandoductin wrote:
@rich2005 or anyone else on Linux:
Can you try release 7 (in post #1) and let me know if the forward slashes change work in Linux. ...


(Hardcoded or not ;)) All three functions working ok here on linux

_________________
Image


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 1:46 pm  (#34) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
Now release 8.
Changed to not hardcoding slashes but use os.path.join() like Dinasset suggested.

_________________
TinT


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Wed Sep 21, 2016 1:54 pm  (#35) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
@Dinasset
What about the subfolder thing you mentioned? do you mean where the functions are registered?... I already have all 3 functions under <Gradients>/SVG/

_________________
TinT


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Thu Sep 22, 2016 12:26 am  (#36) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
I mean the sub-folder where to store the created gradients.
You had (old version) : filename = "~\\.gimp-2.8\\gradients\\" + gradient_name + ".svg"
I changed it for myself to : filename = "~\\.gimp-2.8\\gradients\\SVG\\" + gradient_name + ".svg"
but having the subfolder name as a parameter in the panel could be more flexible

_________________
"Where am I ?"


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Thu Sep 22, 2016 12:46 am  (#37) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
:( ah too late now, users might have already created some files inside main gradients folder.
i don't want to deal with handling subfolder SVG and main gradients folder.

_________________
TinT


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Thu Sep 22, 2016 1:01 am  (#38) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
As you like Tin, but in any case if you add the subfolder parameter you'll not have to deal both with the subfolder and the main, only with the entered subfolder (user can move the already created there, if preferred).
No problem for me, I stick on my "patched" version.
Thanks again.

_________________
"Where am I ?"


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Thu Sep 22, 2016 6:46 am  (#39) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Why can't you add the subfolder option as a user defined destination? EXPORT AS Then just have GIMP refresh gradients? Not sure if i need version 8 Tran. Mine works fine now that i use the same names in the code and as the file name itself. :) Fine addition to GIMP. Thank you.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Creating svg gradients for Gimp (python script 3 functions).
PostPosted: Tue Nov 01, 2016 4:32 pm  (#40) 
Offline
Global Moderator
User avatar

Joined: Oct 02, 2014
Posts: 4514
Location: Sydney Australia
Tin - do I have a script problem or is it just a 'seniors moment' of total confusion. :oops:

A few weeks back I created a number of SVG gradients using your script, and was able to add and delete stops. Now I want to amend one but when I right click on the gradient and select the add/delete stops options, the forms that display seem to have 'deformed sliders', like these examples -

Image

Image

I can create a new SVG gradient, but again if I try to add/delete stops, the same forms as above are displayed and they do not look like your original examples above.

I have dowmloaded/installed the script again but nothing changes.

_________________
Image

Respect should be offered freely but hard earned


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

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Eager to learn how to draw pixel functions in GIMP python

2

No new posts Attachment(s) Scripting GEGL functions

52

No new posts Attachment(s) Learning to do first Python script

6

No new posts .py script not showing under Python-Fu

3

No new posts Attachment(s) My first Python Script for Gimp

7



* Login  



Powered by phpBB3 © phpBB Group