[solved] basic Qs about Inkscape gradients

Post questions on how to use or achieve an effect in Inkscape.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

[solved] basic Qs about Inkscape gradients

Postby brynn » Tue Oct 02, 2007 11:48 am

Hi Friends,
This is not so much a 'how do I do a certain effect' question, as it is just a basic 'how do I work with Inkscape gradients in general' question. Since I'm not a graphics professional or artist, things that might be intuitive for them, are not for me. So there are a few things that I have not been able to figure out by trial and error.

I have learned how to apply a gradient to an object, and that a Stop seems to be the endpoint of a segment within a gradient...at least I'm pretty sure that's what it is ;) Using the Object Fill and Stroke dialog, clicking on a gradient, and then the Edit button, opens the Gradient Editor dialog. At this point, I notice in the toolbar which appears along the top of the main Inkscape window, that the gradient has been given a name, always a 4 digit number. In the Gradient Editor, there are 2 Stops, also named by 4 digit numbers, both very close to the name of the gradient.

Intuitive to me would be that these 1st 2 stops somehow define the gradient, because they cannot be deleted. More Stops can be added, but these 2 cannot be deleted. This would lead me automatically to suspect that one stop defines one end of the gradient, and the other defines the other end. But their number names are very close to the gradient name. Say for example the gradient is called #1234, one stop would be 1236 and the other 1238. Since in my playing around with Inkscape gradients, I've seen them named anywhere between 1000 and 9999, it seems sort of unlikely that a gradient which starts with a fully opaque color, ending fully transparent could be defined by a range of only 4. Here I'm assuming that the sequence of numbers is of some importance. Because again, intuitively, why would the gradients be named by numbers, if the sequence is not important? If the gradients were named with 6 numbers, that would really make sense!! (because of the html color naming system) But, oh well.... :roll:

So my 1st questions:
-- Why is not the 1st stop the same name/number as the gradient itself?
-- What do the 2 undeletable stops' numbers represent, besides just their name?

The next problem I've come up against, is how exactly to edit the gradient. Apparently one selects gradients and stops which one wants to edit, by clicking on their number/names, rather than with the object, gradient, path, shape, etc. selectors. Because I can have a particular gradient selected (highlighted), all by itself, but editing the stops actually edits a different gradient, one that is not selected at all, and could even be in an entirely different document!. Is that how it's supposed to be?

Along the same theme, it looks to me like one cannot change the gradient's base color, only its stops. So if I have a gradient that goes from opaque blue to fully transparent, then I change my mind, and I want it to start with red and end with blue, there's no way to get rid of the blue part which seems to be represented by the difference between the gradient's name and 1st stop. The only way to get rid of that blue part is to create an entirely new gradient, with different number/names. Have I got that right?

Once I've finally got a gradient exactly how I want it, is there any way to save it, to use it later? Because getting back to intuition, if I saved (or remembered) the gradient's number name from some other document, and I wanted to use it again....well 1st, where would I enterthe number/name, to call up the gradient? Or from where do I select the number/name, in order to use it again -- the previous document where I used it before? Would I simply open that other document and copy the gradient? Well, no, I tried that, but when I needed to tweak the gradient a little for the new doc, it tweaked the original one too, even though I wasn't even working on that doc. (Hhhm, I wonder if it would tweak the original one if the original doc was actually closed??? Hhhhm...)
So:
-- Is it possible to save a gradient for later use? If so, how?
-- If not, how does one begin to recreate a gradient?

Plus, with this number/name system there can only be 8999 possible gradients, yet clearly there are....well, probably an infinite number of potential gradients in the real world. Or, is a gradient named #1234, without any modification, always the same gradient?

I guess this is kind of leading into some questions I have about using colors in Inkscape, so I'll stop here, for now. (But the eyedropper tool in Inkscape sure does not work the way it does in other graphics programs :? , lol.)

Thanks for you help.
All best.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: basic Qs about Inkscape gradients

Postby microUgly » Tue Oct 02, 2007 4:39 pm

This has to be the longest question ever :) I'll do my best to answer it.
brynn wrote:So my 1st questions:
-- Why is not the 1st stop the same name/number as the gradient itself?
-- What do the 2 undeletable stops' numbers represent, besides just their name?

The numbers literally mean nothing. They are just a name to uniquely identify the gradient. The gradient has to have a name of some sort so Inkscape picks one automatically - I don't know what system it uses though. The numbers have no relevance on how a gradient looks.

brynn wrote:but editing the stops actually edits a different gradient, one that is not selected at all, and could even be in an entirely different document!. Is that how it's supposed to be?


The "Gradient Editor" does not automatically change to the gradient of the selected object. It will remember the last edited gradient. To edit a different gradient, select the object and then if you have the "Gradient tool" select you'll see an "Edit..." button on the tool control bar. Otherwise you can select the Edit button from the "Fill and stroke" palette. Either of these option witll change the "Gradient editor" to modify the gradient of the selected object.

brynn wrote:Along the same theme, it looks to me like one cannot change the gradient's base color, only its stops. So if I have a gradient that goes from opaque blue to fully transparent, then I change my mind, and I want it to start with red and end with blue, there's no way to get rid of the blue part which seems to be represented by the difference between the gradient's name and 1st stop. The only way to get rid of that blue part is to create an entirely new gradient, with different number/names. Have I got that right?

A gradient doesn't have a base colour, only stop colours. I think you're getting confused because even though a stop is transparent it still has a colour. So, if you have a opaque Red stop and a transparent stop, if that transparent stop is Blue you'll see the red change to blue as it becomes transparent. The gradient editor show the colour and transparency for each stop.

brynn wrote:Once I've finally got a gradient exactly how I want it, is there any way to save it, to use it later? Because getting back to intuition, if I saved (or remembered) the gradient's number name from some other document, and I wanted to use it again....well 1st, where would I enterthe number/name, to call up the gradient? Or from where do I select the number/name, in order to use it again -- the previous document where I used it before? Would I simply open that other document and copy the gradient? Well, no, I tried that, but when I needed to tweak the gradient a little for the new doc, it tweaked the original one too, even though I wasn't even working on that doc. (Hhhm, I wonder if it would tweak the original one if the original doc was actually closed??? Hhhhm...)
So:
-- Is it possible to save a gradient for later use? If so, how?
-- If not, how does one begin to recreate a gradient?

What a mouthful :) Ok, gradient are defined in the document so they won't appear in different documents. If you want to reuse a gradient from another document, copy the object that uses the gradient, the select the object in the other document you want to apply the gradient to and paste the style (Ctrl + Shift + V). But there is an issue which brings us back to your first question, and is perhaps something the developers need to fix. If two gradients in two document have the same name, then when you copy and paste them a new name will not be created and the style will not change because Inkscape assumes they are the same. What you will need to do is duplicate the gradient until you get a number that doesn't already exist in the other document already.

brynn wrote:Plus, with this number/name system there can only be 8999 possible gradients, yet clearly there are....well, probably an infinite number of potential gradients in the real world. Or, is a gradient named #1234, without any modification, always the same gradient?

Again, this is just a number that is specific to the document you are editing. Two document can use the same number for two very different gradients (but as we have seen using the same number can be a problem when copying gradients to different documents). So the 8999 limit does exist, but it's a limit per document and it's unlikely any single document would contain that many gradients.

I have to rush off without proof reading this, so I'm sorry if some things don't make sense. I'll fix them when I come back.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: basic Qs about Inkscape gradients

Postby microUgly » Tue Oct 02, 2007 5:58 pm

Also
when I needed to tweak the gradient a little for the new doc, it tweaked the original one too, even though I wasn't even working on that doc.

The gradient editor is shared among multiple documents, so whilst you may be working in one document the gradient editor may still be set to edit the gradient in the other document. This might be your problem here.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: basic Qs about Inkscape gradients

Postby brynn » Thu Oct 04, 2007 9:08 pm

Oh dear, it was not my intention to set a new record :D. I guess I want my messages to contain as much detail about an issue as possible, and at the same time, to accurately convey the facts of an issue. So the more confused I am about an issue, the more wordy my message becomes ;)

Thanks for your comments. Actually I think I understand almost everything now, that I didn't before. But just to be sure, a quick review.
-- The names of the gradients and the names of the stops have no numerical value.
-- The 2 undeletable stops DO represent the 2 ends of the gradient, but there is no significance to the number/names.
-- Just like everything else, the gradient has to be selected, before one can work on it. But instead of using the Select and Transform Objects tool, like with everything else, one clicks on the name of the gradient to select it.
-- A gradient cannot be saved. But one CAN copy a gradient from other documents. Ok, I guess I'm not entirely clear about saving, or not saving gradients, as the case may be. So if you're just playing around, and you happen to make a gradient that you really like, and you think you might want to use it again -- then what? I guess you either have to make notes about stops and colors, so you can recreate it later; or save your "playing around" document, to be sure you'll have it later. Hhhhhmm, so I'm thinking, if one uses gradients a lot, it might be a good idea to make a folder for saving docs with gradients, for future reference....you think? Or maybe save just one big document which contains only your sample gradients?

Oh, but I'm still not clear about the length of segments within a gradient. When one adds a stop, it creates a segment within the gradient, which has the new stop on 1 end, and whatever stop was selected when the new stop was added, as the other end. So when the 1st new stop is added, does it exactly bisect the gradient...or not bisect, but create 2 equal segments within the gradient? Does the addition of any stop create 2 equal segments between the stop which was selected when the new stop was added, and the newly added stop? What if one wanted to create a non-symetrical gradient -- say the 1st 3/4 of the gradient is all blue, then there is a thin yellow strip, and the rest is blue again? OOooohh, I think I know -- you start with a gradient that starts and ends with blue, then you add a few stops, but you leave them blue, then you add a stop and make it yellow. And then maybe add another blue stop, or 2? Something like that?

Yeah, I think I might be getting it now....you think?

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: basic Qs about Inkscape gradients

Postby kelan » Thu Oct 04, 2007 10:30 pm

It sounds like you're getting it. Here are answers to your other questions.

brynn wrote:So when the 1st new stop is added, does it exactly bisect the gradient...or not bisect, but create 2 equal segments within the gradient? Does the addition of any stop create 2 equal segments between the stop which was selected when the new stop was added, and the newly added stop?

When you add a stop, it will create a new one exactly between the currently selected stop and the next stop. (If the last stop is selected, the new stop will be between the previous stop and the last.) So if you have the first stop selected (which is at position 0), and the next stop is at position 0.60, the newly created stop will be at position 0.30.

brynn wrote:What if one wanted to create a non-symetrical gradient -- say the 1st 3/4 of the gradient is all blue, then there is a thin yellow strip, and the rest is blue again?

You've got the right idea. If you want solid lines in the gradient, you need two stops to overlap so that you don't see the transition between them. So if you wanted a gradient that was solid blue for 3/4, then a small solid yellow line, then blue, you could have a gradient like this:
  • Stop 1: position 0.00, color #0000ffff
  • Stop 2: position 0.75, color #0000ffff
  • Stop 3: position 0.75, color #ffff00ff
  • Stop 4: position 0.76, color #ffff00ff
  • Stop 5: position 0.76, color #0000ffff
  • Stop 6: position 1.00, color #0000ffff

Notice that because some of the stops have the same position, you don't see any blue-to-yellow fading.

Simarilius
Posts: 626
Joined: Wed Jun 06, 2007 2:37 am

Re: basic Qs about Inkscape gradients

Postby Simarilius » Fri Oct 05, 2007 5:52 am

kelan wrote:It sounds like you're getting it. Here are answers to your other questions.

brynn wrote:So when the 1st new stop is added, does it exactly bisect the gradient...or not bisect, but create 2 equal segments within the gradient? Does the addition of any stop create 2 equal segments between the stop which was selected when the new stop was added, and the newly added stop?

When you add a stop, it will create a new one exactly between the currently selected stop and the next stop. (If the last stop is selected, the new stop will be between the previous stop and the last.) So if you have the first stop selected (which is at position 0), and the next stop is at position 0.60, the newly created stop will be at position 0.30.


Its halfway between in position, and halfway between in color too, idea being if you want to bias your grad or whatever you dont have to mess with the colors.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: basic Qs about Inkscape gradients

Postby microUgly » Fri Oct 05, 2007 7:26 am

kelan wrote:Notice that because some of the stops have the same position, you don't see any blue-to-yellow fading.

Note that when you have such a sharp transition in colour, as in this example where some stops have the same position, you may notice there is no antialising of the transition making it look pixelated. For this reason I always put a slight gap between stops to compensate for the effect.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: basic Qs about Inkscape gradients

Postby brynn » Sun Oct 07, 2007 9:48 pm

Image Huh?
Stop 1: position 0.00, color #0000ffff
Stop 2: position 0.75, color #0000ffff
Stop 3: position 0.75, color #ffff00ff
Stop 4: position 0.76, color #ffff00ff
Stop 5: position 0.76, color #0000ffff
Stop 6: position 1.00, color #0000ffff

Well, I was actually thinking of having some blue-to-yellow shading. But more importantly, how did Stop 2 end up in the 0.75 position? And how did Stop 4 get to be 0.76? Because kelan said
"When you add a stop, it will create a new one exactly between the currently selected stop and the next stop."

And Similarius said
"Its halfway between in position, and halfway between in color too,..."

So if the above gradient started life with Stop 1 and Stop 6, Stop 6 would have originally been....well, let's say the "End Stop" right? Because it's undeletable, and it represents....um, well it could actually be either the beginning OR the end of the gradient depending on one's perspective. Anyway, we wouldn't necessarily know it was the 6th, at 1st. So with Stop 1 selected (clicked), one would then click the Add Stop button, creating a 3rd stop, named Stop 2, and changing Stop 2 to Stop 3, halfway between the original Stop 1 and the original Stop 2 (now called 3). Yes?

So using your notation, here's how I understand it to work:
x -- Stop 1, Position 0.0, color #0000ff
n -- Stop 2, Positioin 0.5, color #0000ff
-- Stop 3, Position 1.0, color #0000ff
(in my notation, x=click this stop b4 clicking Add Stop, n=the newly Added Stop)

Next:
x -- Stop 1, Position 0.0, color #0000ff
n -- Stop 2, Positioin 0.25, color #0000ff
-- Stop 3, Position 0.50, color #0000ff
-- Stop 4, Position 1.0, color #0000ff

Next:
-- Stop 1, Position 0.0, color #0000ff
-- Stop 2, Positioin 0.25, color #0000ff
x -- Stop 3, Position 0.50, color #0000ff
n -- Stop 4, Position 0.75, color #ffff00
-- Stop 5, Position 1.0, color #0000ff

And maybe the final step:
-- Stop 1, Position 0.0, color #0000ff
-- Stop 2, Positioin 0.25, color #0000ff
-- Stop 3, Position 0.50, color #0000ff
-- Stop 4, Position 0.75, color #ffff00
n -- Stop 5, Position 0.875, color=#0000ff
x -- Stop 6, Position 1.0, color #0000ff

I haven't actually followed these steps to find out if it will produce what I want. But that's how I understand the process ought to work. But it looks a lot different than what kelan posted. So can you determine where I'm going wrong, by looking at the samples I made?

Hhm, maybe I'm misu nderstanding what kelan means by position. By position, maybe you mean the Offset slider/setting??? I'm using Position as the position of t he stop in the gradient.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: basic Qs about Inkscape gradients

Postby microUgly » Mon Oct 08, 2007 8:25 am

Position and offset, as refered to in this thread, are the same thing. They set the Stop 2 offset (position) to 0.75 and Stop 4 to offset (position) to 0.76.

I recommend you read this guide - http://tavmjong.free.fr/INKSCAPE/MANUAL ... nts-Define

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: basic Qs about Inkscape gradients

Postby brynn » Mon Oct 08, 2007 6:53 pm

I'm really sorry this is dragging on so long, and that I'm having such a hard time understanding Inkscape gradients. Image

First I want to say that I looked at ALL the resources listed in this thread of the Inkscape Resources forum, B4 I ever started this topic/thread
(viewtopic.php?f=11&t=2).
And I did not find any instruction or explanation that answered my questions about gradients. And in fact, I looked at the Table of Contents of the tavmjong reference, and Gradients are not even mentioned. Although I see from microUgly's link that info about gradients apparently falls under Editing Basics. Unfortunately, I did not make the connection that gradients would be found there.

Anyway, I've now read through those few paragraphs, and found one sentence which was helpful
"Note that the new stop has an offset of 0.25, that is the center of the stop will be one quarter of the Gradient width from the left."

So am I to understand the the Offset slider setting defines the position of a stop within the gradient? This only leaves me MORE confused, unfortunately. Because I thought we already established earlier in this thread, that a new stop's position is "exactly between" the stop which was selected when the new stop was added, and the next stop.

Maybe this is how it goes??? When one clicks the Add Stop button, the new stop is placed exactly between the existing stops. But then, one can....sort of "fine tune" the stop's position using the Offset slider. Welllll.....but then the Offset slider would be a measure between each stop.....and my current understanding, is that it actually represents a measure of the entire gradient.

OOOooohhhh! Is that why, with certain stops, the Offset slider does not represent the full range of the gradient? Oh-Oh-Oh!!! Ok, THAT'S why, even though the Offset slider is grayed out for the 2 original end stops, it's set to 0.0 for one end and 1.0 for the other end. The 1st stop one adds always has the full range of 0.0 to 1.0 on the Offset slider setting. But with any additional stop, the Offset slider only offers a certain range, within the whole, depending on where the stop is located, in the list of stops. And that's because any new stop after the 1st, so meaning the 2nd or higher new stop, parts of the gradient are not available, they can't be altered from that stop. OK, I think I've got it. Let's see if I can state it clearly....

The Offset slider represents the segment within the gradient which can be edited from whatever stop is selected. This is the answer to my question about defining the length and/or placement of segments within the gradient Only the 1st new stop can potentially edit any part of the gradient, but still, only 1 (one) part of it. Does every new stop reduce by half, the length of the segments along which one can edit the gradient? The more stops one adds, the shorter each segment becomes?

So Stops are not so much defining the ends of segments within a gradient, as they define the middle of the distance between the stop just before and just after it, in the list of stops. Well no, wow, so if I've got it right by now, it's really kind of hard to define exactly what a Stop is.

Ok I'm going to stop babbling for now, and wait to find out if I'm on the right track..

And sincerely, THANK YOU all for your patience with me! Image

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: basic Qs about Inkscape gradients

Postby kelan » Tue Oct 09, 2007 2:29 am

Ok, I think I understand your question now. Your last post is on the right track. Here's a more precise description of what a gradient actually is.

A gradient is a sequence of colors, with smooth transitions between neighboring colors. Each stop specifies a color and an offset. A stop with color #0000ffff at offset 0.25 says that one quarter of the way into the gradient, the exact color should be blue, with transitions between the colors of the stops before and after it. So you don't really edit the "segments" of the gradient, which are the transition areas. The stops are single points along the gradient that say, "At this point, we should have this specific color, and then blend to the next one."

In 0.45, you edit the stops one at a time in the Gradient Editor. Although when a stop is created, it sits exactly between the previous stop and the next, the slider lets you adjust the offset all the way down to the previous stop, or all the way up to the next. The slider's lower and upper bounds depend on the offsets of the previous and next stops. The number displayed next to the slider is the offset in the overall gradient. That's how you can edit two adjacent stops to have the same offset, which means you won't see a transition area between them (because the transition area is squished down to nothing).

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: basic Qs about Inkscape gradients

Postby microUgly » Tue Oct 09, 2007 6:18 am

I just wanted to point out that you're not going to have this confusion about gradients in 0.46. The gradients are edited on the canvas where you can see each stop and how they are related. Positioning each stop is way more intuitive in the new system. The gradient editor you are working with is being completely removed in 0.46.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: basic Qs about Inkscape gradients

Postby brynn » Thu Oct 11, 2007 6:58 am

Aaaahh!
Ok, thank you, kelan.
Whew! I could never have figured out Inkscape gradients by myself Image. Now that I more or less understand them, it's almost too bad to hear they will be "overhauled" in the next release :roll: Hopefully the new setup will bring to gradients the same ease of use as rules most of the rest of Inkscape. You know, I tried several free graphics programs, a couple of years ago, and ended up choosing The GIMP, because it seems to have the greatest potential among the others I tried. But I've struggled mightily learning how to use it! So I've been mostly thrilled with Inkscape, because it is SO much easier to use. And eventually, I hope to use them together.

Anyway, thanks to everyone for your help and patience. I believe all my current questions have been answered. I may have more, in the future, as I get more of a feel for it. But for now, I'm all set Image

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: basic Qs about Inkscape gradients

Postby microUgly » Thu Oct 11, 2007 7:14 am

Great to hear, brynn. I hope you can share your work with us.


Return to “Help with using Inkscape”