shifting gradient colors ? - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions) +--- Thread: shifting gradient colors ? (/Thread-shifting-gradient-colors) Pages:
1
2
|
shifting gradient colors ? - denzjos - 10-22-2021 Is there existing a plugin/script that can shift a gradient by x steps? Let's take a gradient with 256 colors and I want to shift the gradient colors by 2 steps. Then all colors move 2 steps to the right (or left) and colors 255 / 256 become colors 1 and 2. RE: shifting gradient colors ? - Ofnuts - 10-22-2021 A GGR file being basically a text file, did you try to edit one and move the first two color lines to the bottom? RE: shifting gradient colors ? - denzjos - 10-23-2021 Ofnuts, thanks for the reply. I've seen that the first line is a number that corresponds with the amount of lines in the gradient. The first line begin with 0.000000 and is also the end value of the last line. I'll try it out. RE: shifting gradient colors ? - denzjos - 10-23-2021 @Ofnuts, I've moved 2 lines from a gradient file from the bottom to the top (line 256 to line 2, line 255 to line 1) and saved the file on the same folder with a new name. Gimp could'n find the gradient. Then I changed also the name of the gradient in the file and gimp could'n find the gradient. Then I simply copy a gradient and saved it with a new name in the same folder and gimp did find this copy. I look further to find out why this happens. I'll search out with the help of this tools how the gradient file is build : http://gimpchat.com/viewtopic.php?f=12&t=2567&sid=7d78638b3424cd15c4dbbd65e21f2485&start=20 RE: shifting gradient colors ? - Ofnuts - 10-23-2021 Another technique: you can easily build simple gradients from palettes (this is actually faster than building the gradient from scratch). See Palette to gradient in the menu in the Palettes list. So if you can create your first gradient that way, to shift it you just have to edit the palette, move the first two colors to the end, and re-create a new gradient from that. [attachment=6901]
[attachment=6902]
RE: shifting gradient colors ? - rich2005 - 10-24-2021 I could not get moving an entry in the .ggr file working. Gimp not happy with that I thought there must be better way than generating a gradient from an image, and Ofnuts had something up his sleeve. Although editing a palette is easy. Another way RobA http://www.silent9.com/incoming/scripts/ Has a script gradient-from-image.scm (look for date 2009-04-09). Very quick. Does what it says. Then use Layer -> Transform -> Offset to nudge the gradient image along. Repeat gradient-from-image.scm example: https://i.imgur.com/m4pCu5C.mp4 Might work for you depending on requirements. RE: shifting gradient colors ? - denzjos - 10-29-2021 Ofnuts and Rich, sorry for the late reaction and thanks for the solutions concerning this issue. I prefer the solution Rich suggested. I have problems with shifting colors in palettes. Every time I try to move a color, it move to its original position in the palette. I think I don't quite understand the workflow Ofnuts suggested. RE: shifting gradient colors ? - rich2005 - 10-29-2021 (10-29-2021, 08:20 AM)denzjos Wrote: ...snip....I think I don't quite understand the workflow Ofnuts suggested. A Gimp palette file something.gpl is text, edit it with a suitable text editor. A existing palette is right click Palette-to-Gradient which gives new gradient in the Gradient dock. [attachment=6933] Edit the .gpl , this one moved bottom line to the top (remember to save/update it). Refresh the palettes for the edit to take effect, Repeat Palette-to-Gradient [attachment=6934] RE: shifting gradient colors ? - denzjos - 10-29-2021 Rich, thank you for the explanation. Now I got it. Ofnuts, thanks again for the tip (I could'nt find the right way because I was't on the right track... ) Issue solved. RE: shifting gradient colors ? - denzjos - 11-01-2021 I've made a LibreOffice Calc spreadsheet to easy multiple shift values in a gimp palette file. How to use it : - open a palette gpl file in a text editor - select all the text - copy the selection - paste the selection in the A1 cell from the spreadsheet - in most cases the A column contain a header with some numbers underneath, column B sometimes contain some text Columns A and B are the original values and will not changed Columns D and E are copies from column A and B and are used to work with Column E is used for calculation, don't change it Columns H and I contain the new shifted values There is only one value one have to fill in to shift the values ; cell L1 If the shift value is greater than the length of the file then there is a warning in cell L2 After a shift value is filled in, the values in columns H and I are shifted straight away To save the shifted values : - select the values in column H an I (not the columns) - File / Print (choose 'print to file' and 'print selected cells') - save it as 'name_x.gpl' where x is a number if one make several shifted palette files As an example, if the imported palette file has 256 lines with values, one can shift with value 50,100,150,200 and every time save the values with names : green01.gpl, green02.gpl.........green04.gpl. You just have to load the original file once to do this. To change the value in another palette, just erase column A and B and paste the new palette as described above. [attachment=6969] [attachment=6970] |