Is it possible to edit image gradients?

Post questions on how to use or achieve an effect in Inkscape.
android272
Posts: 8
Joined: Thu Aug 28, 2014 7:40 pm

Is it possible to edit image gradients?

Postby android272 » Fri Aug 29, 2014 4:15 am

I am not asking how to edit the gradients color, stops, opacity, or position on the image. I have many objects on my canvas with the same exact gradient and it seems as though every time I make a copy of an object inkscape duplicates my gradient. I have SOOOOOOOOOOOOOOOOOO many duplicates of the exact same gradient its not funny. I have not changed the color of the gradient what so ever since I created it and started making my icons that gradient.

should I just clear my icons gradient by changing it to a solid flat color, then copy it to a new image and recreate the gradients? This would suck since I have so many. I have around like 500 the last time I counted.

User avatar
ianp5a
Posts: 106
Joined: Thu Sep 02, 2010 1:30 am

Solution

Postby ianp5a » Fri Aug 29, 2014 5:11 pm

Yes. See this thread: Duplicate object with gradient: Edit 1 gradient = edit both?
There are some bugs. But also a workaround.
I had the same problem and did some investigation lower down in the thread.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to edit image gradients?

Postby tylerdurden » Sat Aug 30, 2014 12:41 am

I'd probably use a text editor to change all the references to the "original" gradient. (I'm on Windoze, so I use "Textpad".)

Each object will still have their own gradient id, but all can point to the original via xlink:href...

Code: Select all

        <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient3755"
       id="linearGradient3799"
       gradientUnits="userSpaceOnUse"
       x1="31.4285717"
       y1="105.2193222"
       x2="137.1428528"
       y2="105.2193222" />


In the above, the "linearGradient3799" is the id for the third object's gradient, but it is referencing "#linearGradient3755" (the original object's gradient settings for stop info). That xlink:href value is the item to replace.

It will require find/replace in all the defs, but might be faster than using the pallette GUI.

After revision, vacum-defs would remove unused gradients.
Attachments
GradientEdit.svg
three objects with gradient fill
(4.32 KiB) Downloaded 166 times
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

android272
Posts: 8
Joined: Thu Aug 28, 2014 7:40 pm

Re: Is it possible to edit image gradients?

Postby android272 » Sun Aug 31, 2014 9:11 am

Thanks this is great. Why does Inkscape do this? I mean I understand having many gradients with slight changes but if there are two gradients that are exactly the same should not Inkscape use the original gradient already in use?

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to edit image gradients?

Postby tylerdurden » Sun Aug 31, 2014 9:51 am

As noted in the topic linked above, users get the choice:
Ctrl-D (duplicate) of an object does indeed use the very same gradient.
Copy/paste generates a new gradient id with the same attributes, that the user can modify without disrupting the original.

The best choice depends on the user's needs.

In the example file I posted above, the first object is the original, the second is copy/paste, the third is a duplicate of the original. They all look the same, but only the first and third share the same gradient fill. The difference can be distinguished by looking in the fill/stroke panel, or in the Inkscape XML editor, or in a text/unix editor.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/


Return to “Help with using Inkscape”