Page 1 of 1

Changing hue just for one channel

Posted: 2014-10-30T02:37:32-07:00
by BubbleBobble
Dear friends,
I am not a graphic designer and I just started to read about some concepts like "channels" and "colorspace", despite of this I am trying to write a script to change the hue for a group of icons. What I need is to change the hue specifically for one channel (blue), then I tried this:

Code: Select all

convert icon.png  -modulate 100,100,50 -channel Blue icon_after.png
but, as result, the hue modulation is applied to the whole picture ignoring the blue channel given.

I tried many other options without success, can anyone give me any hint?

Thank you in advance.

Cesare

Re: Changing hue just for one channel

Posted: 2014-10-30T06:46:51-07:00
by snibgo
BubbleBobble wrote:What I need is to change the hue specifically for one channel (blue)...
I don't understand what that means. Example hues are: blue, red, purple, and so on. A hue is a wavelength of colour, independent of saturation or lightness.

"Changing the hue of just the blue channel" doesn't make sense. Do you mean that you want to change blue to some other colour, such as green?

Perhaps you can upload an example of what you want.

Re: Changing hue just for one channel

Posted: 2014-10-30T08:49:50-07:00
by BubbleBobble
Snibco,
thank you for your reply. Yes I need to change one color to another one. As said, I am not a graphic expert, please apoligize my incompetence to use the appropriate terms.

I was successful to edit an icon. With GIMP I selected the channel cyano and changed its hue.

The result is this, from light blue:
Image
to pink:
Image

I would like to do the same with IM. Thank you.

Re: Changing hue just for one channel

Posted: 2014-10-30T10:26:38-07:00
by snibgo
Gimp's eyedropper tell me your cyan is approximately #72adcd. The following shifts the hue of the image, with greatest effect where the color is exactly #72adcd.

Windows BAT script.

Code: Select all

convert ^
  book.png ^
  ( -clone 0 ^
    -colorspace HSL -channel R ^
    -evaluate AddModulus 33%% ^
    +channel -colorspace sRGB ^
    -write d0.png ^
  ) ^
  ( -clone 0 ^
    ( +clone -fill #72adcd -colorize 100 ) ^
    -compose Difference -composite ^
    -colorspace Gray ^
    -auto-level -negate ^
    -alpha off ^
    -write dx.png ^
  ) ^
  -compose Over -composite ^
  out.png
Adjust the "33%" to suit.

Re: Changing hue just for one channel

Posted: 2014-10-30T12:09:30-07:00
by BubbleBobble
I tried your script using bash (I am running Xubuntu 14.04)

Code: Select all

#!/bin/bash

EXE="convert book.png"
ARG1="\( -clone 0 -colorspace HSL -channel R -evaluate AddModulus 33% +channel -colorspace sRGB -write d0.png \)"
ARG2="\( -clone 0 \( +clone -fill \#72adcd -colorize 100 \) -compose Difference -composite -colorspace Gray -auto-level -negate -alpha off -write dx.png \)"
ARG3="-compose Over -composite"
OUT="out.png"

CMD="$EXE $ARG1 $ARG2 $ARG3 $OUT"

echo $CMD

eval $CMD
and I tried to change both the "-fill" color #72adcd and the AddModulus percent but I always get a result like this:

before

Image

after

Image

It seems the processing affects also the orange/red color. I tried to change some options of your script but it is complex for my competence.
Do you have any hints?

Re: Changing hue just for one channel

Posted: 2014-10-30T12:20:41-07:00
by snibgo
To narrow the range of hues that are shifted, use "-level" instead of "-auto-level". Those "-write" operations are only for debuging; you can leave them out.

Code: Select all

convert ^
  book.png ^
  ( -clone 0 ^
    -colorspace HSL -channel R ^
    -evaluate AddModulus 33%% ^
    +channel -colorspace sRGB ^
  ) ^
  ( -clone 0 ^
    ( +clone -fill #72adcd -colorize 100 ) ^
    -compose Difference -composite ^
    -colorspace Gray ^
    -level 0,20%% -negate ^
    -alpha off ^
  ) ^
  -compose Over -composite ^
  d.png

Re: Changing hue just for one channel

Posted: 2014-10-31T08:19:05-07:00
by BubbleBobble
It works, thank you!
I just had to decrease the level to 5% and changed the fill color for the best result.

Code: Select all

#!/bin/bash

EXE="convert book.png"
ARG1="\( -clone 0 -colorspace HSL -channel R -evaluate AddModulus 30% +channel -colorspace sRGB  \)"
ARG2="\( -clone 0 \( +clone -fill \#6da6c5 -colorize 100 \) -compose Difference -composite -colorspace Gray -level 0,5% -negate -alpha off \)"
ARG3="-compose Over -composite"
OUT="out.png"
CMD="$EXE $ARG1 $ARG2 $ARG3 $OUT"
echo $CMD
eval $CMD

Can I take advantage of you for the last time? This script works perfectly with PNG images but the icons package, that I want to modify, contains also SVG images.
If I process with the script a SVG image, the result is just a completely black image. I tried to play with IM and SVG images and I always get black images.
Is there something I am missing when processing SVG?

Re: Changing hue just for one channel

Posted: 2014-10-31T08:29:02-07:00
by snibgo
Check the SVG with a simple convert:

Code: Select all

convert -verbose in.svg out.png
Paste the text output here.

There may be something weird in the SVG file, or it may not be correctly processed by your SVG renderer.

If you paste the contents of the SVG file here, between [ code ] and [ /code ], I can take a look.

If the renderer is the problem, try it with Inkscape.

Re: Changing hue just for one channel

Posted: 2014-11-10T14:59:06-07:00
by BubbleBobble
I apologize for my delay but in the meanwhile I tried to play with Gimp without any particular result and, at the end, I have understood that PNG and SVG are two different schools :)

Anyway here the result of conversion:

Code: Select all

$ convert -verbose bookmarks.svg out.png
bookmarks.svg SVG 96x96 96x96+0+0 16-bit DirectClass 24.2KB 0.000u 0:00.009
bookmarks.svg=>out.png SVG 96x96 96x96+0+0 16-bit DirectClass 4.1KB 0.010u 0:00.000
This is the input SVG file, which has been extracted from an icons package:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.0"
   width="96"
   height="96"
   id="svg2408"
   style="enable-background:new">
  <defs
     id="defs2410">
    <linearGradient
       id="linearGradient4008">
      <stop
         id="stop4010"
         style="stop-color:#82b9d8;stop-opacity:1"
         offset="0" />
      <stop
         id="stop4012"
         style="stop-color:#589bbe;stop-opacity:1"
         offset="0.71691591" />
      <stop
         id="stop4014"
         style="stop-color:#3d809f;stop-opacity:1"
         offset="1" />
    </linearGradient>
    <linearGradient
       id="linearGradient3874">
      <stop
         id="stop3876"
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0" />
      <stop
         id="stop3878"
         style="stop-color:#ffffff;stop-opacity:0"
         offset="1" />
    </linearGradient>
    <linearGradient
       x1="11.794092"
       y1="3.2126782"
       x2="11.794092"
       y2="20.137329"
       id="linearGradient3317"
       gradientUnits="userSpaceOnUse"
       gradientTransform="scale(1.0598527,0.9435274)">
      <stop
         id="stop3319"
         style="stop-color:#3c8fc2;stop-opacity:1"
         offset="0" />
      <stop
         id="stop3321"
         style="stop-color:#2174a6;stop-opacity:1"
         offset="1" />
    </linearGradient>
    <linearGradient
       x1="48.035713"
       y1="25.910715"
       x2="48.035713"
       y2="85.821426"
       id="linearGradient3361"
       xlink:href="#linearGradient3317"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       id="linearGradient3187">
      <stop
         id="stop3189"
         style="stop-color:#589dbe;stop-opacity:1"
         offset="0" />
      <stop
         id="stop3191"
         style="stop-color:#83b0cc;stop-opacity:1"
         offset="1" />
    </linearGradient>
    <linearGradient
       x1="45.447727"
       y1="80.471962"
       x2="45.447727"
       y2="7.0165396"
       id="ButtonShadow"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.0058652,0,0,0.994169,0,12)">
      <stop
         id="stop3750"
         style="stop-color:#000000;stop-opacity:1"
         offset="0" />
      <stop
         id="stop3752"
         style="stop-color:#000000;stop-opacity:0.58823532"
         offset="1" />
    </linearGradient>
    <linearGradient
       x1="48"
       y1="78"
       x2="48"
       y2="5.9877172"
       id="linearGradient3706"
       xlink:href="#linearGradient3187"
       gradientUnits="userSpaceOnUse"
       gradientTransform="translate(0,8)" />
    <filter
       color-interpolation-filters="sRGB"
       id="filter3174">
      <feGaussianBlur
         id="feGaussianBlur3176"
         stdDeviation="1.71" />
    </filter>
    <linearGradient
       x1="45.447727"
       y1="80.471962"
       x2="45.447727"
       y2="5.297224"
       id="linearGradient3664"
       xlink:href="#ButtonShadow"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.0058652,0,0,0.994169,0,12)" />
    <clipPath
       id="clipPath3860">
      <rect
         width="84"
         height="72"
         rx="6"
         ry="6"
         x="6"
         y="18"
         id="rect3862"
         style="fill:#ff00ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
    </clipPath>
    <filter
       x="-0.16558799"
       y="-0.19715989"
       width="1.331176"
       height="1.3943198"
       color-interpolation-filters="sRGB"
       id="filter3870">
      <feGaussianBlur
         id="feGaussianBlur3872"
         stdDeviation="5.1703125" />
    </filter>
    <linearGradient
       x1="48.021698"
       y1="22.933374"
       x2="48.021698"
       y2="81.481377"
       id="linearGradient3123"
       xlink:href="#linearGradient3874"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="34.85965"
       y1="16.275133"
       x2="34.85965"
       y2="26.986736"
       id="linearGradient3105"
       xlink:href="#linearGradient4008"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(0.72,0,0,0.72,1.92,-5.52)" />
    <linearGradient
       x1="43"
       y1="91"
       x2="43"
       y2="7"
       id="linearGradient3952"
       xlink:href="#ButtonShadow"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="45"
       y1="92"
       x2="45"
       y2="7"
       id="linearGradient3961"
       xlink:href="#ButtonShadow"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="45"
       y1="92"
       x2="45"
       y2="7"
       id="linearGradient3969"
       xlink:href="#ButtonShadow"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="45"
       y1="92"
       x2="45"
       y2="7"
       id="linearGradient3977"
       xlink:href="#ButtonShadow"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="45"
       y1="92"
       x2="45"
       y2="7"
       id="linearGradient3986"
       xlink:href="#ButtonShadow"
       gradientUnits="userSpaceOnUse" />
    <radialGradient
       cx="48"
       cy="90.171875"
       r="42"
       fx="48"
       fy="90.171875"
       id="radialGradient2874"
       xlink:href="#linearGradient3737-5"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1.1573129,0,0,0.99590774,-7.551021,0.197132)" />
    <linearGradient
       id="linearGradient3737-5">
      <stop
         id="stop3739-0"
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0" />
      <stop
         id="stop3741-4"
         style="stop-color:#ffffff;stop-opacity:0"
         offset="1" />
    </linearGradient>
    <linearGradient
       id="linearGradient3737">
      <stop
         id="stop3739"
         style="stop-color:#ffffff;stop-opacity:1"
         offset="0" />
      <stop
         id="stop3741"
         style="stop-color:#ffffff;stop-opacity:0"
         offset="1" />
    </linearGradient>
    <linearGradient
       x1="36.357143"
       y1="16"
       x2="36.357143"
       y2="73.994667"
       id="linearGradient3916"
       xlink:href="#linearGradient3737"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       x1="45.5"
       y1="0.48100731"
       x2="45.5"
       y2="96.024994"
       id="linearGradient2600"
       xlink:href="#linearGradient3179-1"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(0.7053571,0,0,0.7053571,34.928572,10.589288)" />
    <linearGradient
       id="linearGradient3179-1">
      <stop
         id="stop3181-3"
         style="stop-color:#000000;stop-opacity:0.56910568"
         offset="0" />
      <stop
         id="stop3187-1"
         style="stop-color:#000000;stop-opacity:0"
         offset="0.07017544" />
      <stop
         id="stop3194-1"
         style="stop-color:#750202;stop-opacity:0.09019608"
         offset="0.20271669" />
      <stop
         id="stop3200-0"
         style="stop-color:#e47b04;stop-opacity:0.13725491"
         offset="0.26648945" />
      <stop
         id="stop3190-3"
         style="stop-color:#ffc906;stop-opacity:0.18431373"
         offset="0.35024518" />
      <stop
         id="stop3198-4"
         style="stop-color:#b76403;stop-opacity:0.13725489"
         offset="0.43899667" />
      <stop
         id="stop3192-0"
         style="stop-color:#700000;stop-opacity:0.09019608"
         offset="0.49777371" />
      <stop
         id="stop3196-3"
         style="stop-color:#fda100;stop-opacity:0.19215687"
         offset="0.65896344" />
      <stop
         id="stop3183-9"
         style="stop-color:#7c0000;stop-opacity:0.60975611"
         offset="1" />
    </linearGradient>
  </defs>
  <metadata
     id="metadata2413">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     id="layer2"
     style="display:none">
    <path
       d="M 14.96875,8.8028918 C 13.32891,8.8028918 12,10.085142 12,11.677892 L 12,19 c -3.324,0 -7,2.676 -7,6 l 0,61 c 0,3.324 2.676,6 6,6 l 74,0 c 3.324,0 6,-2.676 6,-6 l 0,-61 c 0,-3.324 -3.74743,-6 -7.07143,-6 l 0,-0.134608 c 0,-2.389125 -1.97774,-4.3125 -4.4375,-4.3125 l -43.33482,0 -1.46875,-2.875 C 33.95414,10.253293 33.35859,8.8028918 31.71875,8.8028918 l -16.75,0 z"
       inkscape:connector-curvature="0"
       id="rect3745"
       style="opacity:0.9;fill:url(#linearGradient3664);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3174)" />
  </g>
  <g
     id="layer4"
     style="display:inline">
    <path
       d="M 14.125,4 C 9.6910704,4 6,7.568413 6,12 l 0,2.15625 C 3.6235961,15.958367 2,18.759045 2,22 l 0,63 c 0,5.503629 4.496371,10 10,10 l 72,0 c 5.503629,0 10,-4.496371 10,-10 L 94,22 C 94,18.516601 92.146607,15.546894 89.46875,13.78125 88.481551,10.491738 85.526024,8 81.875,8 l -39.5,0 C 40.972352,6.645177 39.835329,5.4903784 38.6875,4.84375 37.192287,4.0014231 35.756649,4.0295412 34.875,4 a 0.92780092,0.92780092 0 0 0 -0.03125,0 c -0.0012,-1.73e-5 -0.03009,-1.73e-5 -0.03125,0 L 34.78125,4 14.125,4 z"
       id="path3984"
       style="opacity:0.07999998;fill:url(#linearGradient3986);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="M 14.125,4.9375 C 10.184407,4.9375 6.9375,8.0807925 6.9375,12 l 0,2.59375 c -2.3826099,1.622076 -4,4.293928 -4,7.40625 l 0,63 c 0,5.001444 4.0610559,9.0625 9.0625,9.0625 l 72,0 c 5.001444,0 9.0625,-4.061056 9.0625,-9.0625 l 0,-63 c 0,-3.260846 -1.77319,-6.039741 -4.34375,-7.625 C 87.957559,11.279325 85.241489,8.9375 81.875,8.9375 l -39.8125,0 C 40.465021,7.3963057 39.290438,6.2599842 38.21875,5.65625 36.945571,4.9390059 35.771277,4.9685784 34.84375,4.9375 a 1.043776,1.043776 0 0 0 -0.03125,0 c -10e-7,0 -0.03125,0 -0.03125,0 l -20.65625,0 z"
       id="path3975"
       style="opacity:0.1;fill:url(#linearGradient3977);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="M 14.125,5.96875 C 10.736326,5.96875 7.96875,8.6567706 7.96875,12 l 0,3.125 c -2.3751432,1.394016 -4,3.920462 -4,6.875 l 0,63 c 0,4.438141 3.5931086,8.03125 8.03125,8.03125 l 72,0 c 4.438141,0 8.03125,-3.593109 8.03125,-8.03125 l 0,-63 c 0,-3.031992 -1.712245,-5.604362 -4.1875,-6.96875 -0.491893,-2.85962 -2.928643,-5.0625 -5.96875,-5.0625 l -40.1875,0 C 39.852667,8.1939079 38.678863,7.1033787 37.71875,6.5625 36.681475,5.9781523 35.778304,6.0011109 34.8125,5.96875 a 1.043776,1.043776 0 0 0 -0.03125,0 l -20.65625,0 z"
       id="path3967"
       style="opacity:0.2;fill:url(#linearGradient3969);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="M 14.125,7 C 11.282105,7 9,9.23 9,12 l 0,3.6875 C 6.6359408,16.808884 5,19.200342 5,22 l 0,63 c 0,3.878 3.122,7 7,7 l 72,0 c 3.878,0 7,-3.122 7,-7 L 91,22 C 91,19.190264 89.346632,16.803629 86.96875,15.6875 86.799101,13.069075 84.606585,11 81.875,11 l -40.59375,0 c -4.220528,-4.1123102 -4.502768,-3.9330794 -6.5,-4 L 14.125,7 z"
       inkscape:connector-curvature="0"
       id="path3908-1"
       style="opacity:0.3;fill:url(#linearGradient3961);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="m 15,7 c -2.77,0 -5,2.23 -5,5 l 0,3.34375 C 7.6664933,16.164656 6,18.378887 6,21 l 0,64 c 0,3.324 2.676,6 6,6 l 72,0 c 3.324,0 6,-2.676 6,-6 L 90,21 C 90,18.358112 88.300137,16.148775 85.9375,15.34375 85.611464,12.893448 83.542274,11 81,11 L 40.46875,11 C 36.35644,6.8876898 36.102271,7.0669206 34.15625,7 L 15,7 z"
       inkscape:connector-curvature="0"
       id="path3941"
       style="opacity:0.45;fill:url(#linearGradient3952);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
  </g>
  <g
     id="layer3"
     style="display:inline">
    <rect
       width="75"
       height="62.678574"
       rx="6"
       ry="6"
       x="10.535714"
       y="23.142857"
       id="rect3352"
       style="fill:url(#linearGradient3361);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="m 15,6 c -2.77,0 -5,2.23 -5,5 l 0,59.8125 c 0,2.39328 1.91922,4.3125 4.3125,4.3125 l 67.375,0 C 84.08078,75.125 86,73.20578 86,70.8125 L 86,15 c 0,-2.77 -2.23,-5 -5,-5 L 40.46875,10 C 36.35644,5.8876898 36.102271,6.0669206 34.15625,6 z"
       inkscape:connector-curvature="0"
       id="path3908"
       style="fill:url(#linearGradient3105);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="m 15,6 c -2.77,0 -5,2.23 -5,5 l 0,59.8125 c 0,2.39328 1.91922,4.3125 4.3125,4.3125 l 67.375,0 C 84.08078,75.125 86,73.20578 86,70.8125 L 86,15 c 0,-2.77 -2.23,-5 -5,-5 L 40.46875,10 C 36.35644,5.8876898 36.102271,6.0669206 34.15625,6 L 15,6 z m 0,1.03125 19.125,0 0.03125,0 c 0.964976,0.031157 1.192535,-0.016972 1.8125,0.34375 0.630289,0.366729 1.706808,1.3318077 3.75,3.375 a 1.043776,1.043776 0 0 0 0.75,0.28125 l 40.53125,0 c 2.209859,0 3.96875,1.758891 3.96875,3.96875 l 0,55.8125 c 0,1.835319 -1.445931,3.28125 -3.28125,3.28125 l -67.375,0 c -1.835319,0 -3.28125,-1.445931 -3.28125,-3.28125 l 0,-59.8125 c 0,-2.2098586 1.758891,-3.96875 3.96875,-3.96875 z"
       inkscape:connector-curvature="0"
       id="path3108"
       style="opacity:0.2;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
  </g>
  <g
     id="layer1"
     style="display:inline">
    <rect
       width="84"
       height="76"
       rx="6"
       ry="6"
       x="6"
       y="14"
       id="rect2419"
       style="fill:url(#linearGradient3706);fill-opacity:1;fill-rule:nonzero;stroke:none" />
    <path
       d="m 12,14 c -3.324,0 -6,2.676 -6,6 l 0,2 0,60 0,2 c 0,0.334721 0.04135,0.6507 0.09375,0.96875 0.0487,0.295596 0.09704,0.596915 0.1875,0.875 0.00988,0.03038 0.020892,0.0636 0.03125,0.09375 0.098865,0.287771 0.2348802,0.547452 0.375,0.8125 0.1445918,0.273507 0.3156161,0.535615 0.5,0.78125 0.1843839,0.245635 0.3737765,0.473472 0.59375,0.6875 0.439947,0.428056 0.94291,0.814526 1.5,1.09375 0.278545,0.139612 0.5734731,0.246947 0.875,0.34375 -0.2562018,-0.100222 -0.4867109,-0.236272 -0.71875,-0.375 -0.00741,-0.0044 -0.023866,0.0045 -0.03125,0 -0.031933,-0.0193 -0.062293,-0.04251 -0.09375,-0.0625 -0.120395,-0.0767 -0.2310226,-0.163513 -0.34375,-0.25 -0.1061728,-0.0808 -0.2132809,-0.161112 -0.3125,-0.25 C 8.4783201,88.557317 8.3087904,88.373362 8.15625,88.1875 8.0486711,88.057245 7.9378561,87.922215 7.84375,87.78125 7.818661,87.74287 7.805304,87.69538 7.78125,87.65625 7.716487,87.553218 7.6510225,87.451733 7.59375,87.34375 7.4927417,87.149044 7.3880752,86.928049 7.3125,86.71875 7.30454,86.69694 7.288911,86.6782 7.28125,86.65625 7.2494249,86.5643 7.2454455,86.469419 7.21875,86.375 7.1884177,86.268382 7.1483606,86.171969 7.125,86.0625 7.0521214,85.720988 7,85.364295 7,85 L 7,83 7,23 7,21 c 0,-2.781848 2.2181517,-5 5,-5 l 2,0 68,0 2,0 c 2.781848,0 5,2.218152 5,5 l 0,2 0,60 0,2 c 0,0.364295 -0.05212,0.720988 -0.125,1.0625 -0.04415,0.206893 -0.08838,0.397658 -0.15625,0.59375 -0.0077,0.02195 -0.0233,0.04069 -0.03125,0.0625 -0.06274,0.173739 -0.138383,0.367449 -0.21875,0.53125 -0.04158,0.0828 -0.07904,0.169954 -0.125,0.25 -0.0546,0.09721 -0.126774,0.18835 -0.1875,0.28125 -0.09411,0.140965 -0.204921,0.275995 -0.3125,0.40625 -0.143174,0.17445 -0.303141,0.346998 -0.46875,0.5 -0.01117,0.0102 -0.01998,0.02115 -0.03125,0.03125 -0.138386,0.125556 -0.285091,0.234436 -0.4375,0.34375 -0.102571,0.07315 -0.204318,0.153364 -0.3125,0.21875 -0.0074,0.0045 -0.02384,-0.0044 -0.03125,0 -0.232039,0.138728 -0.462548,0.274778 -0.71875,0.375 0.301527,-0.0968 0.596455,-0.204138 0.875,-0.34375 0.55709,-0.279224 1.060053,-0.665694 1.5,-1.09375 0.219973,-0.214028 0.409366,-0.441865 0.59375,-0.6875 0.184384,-0.245635 0.355408,-0.507743 0.5,-0.78125 0.14012,-0.265048 0.276135,-0.524729 0.375,-0.8125 0.01041,-0.03078 0.02133,-0.06274 0.03125,-0.09375 0.09046,-0.278085 0.1388,-0.579404 0.1875,-0.875 C 89.95865,84.6507 90,84.334721 90,84 l 0,-2 0,-60 0,-2 c 0,-3.324 -2.676,-6 -6,-6 z"
       inkscape:connector-curvature="0"
       id="rect3728"
       style="opacity:0.35;fill:url(#linearGradient3916);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
    <path
       d="M 12,90 C 8.676,90 6,87.324 6,84 L 6,82 6,26 6,24 c 0,-0.334721 0.04135,-0.6507 0.09375,-0.96875 0.0487,-0.295596 0.09704,-0.596915 0.1875,-0.875 0.00988,-0.03038 0.020892,-0.0636 0.03125,-0.09375 0.098865,-0.287771 0.2348802,-0.547452 0.375,-0.8125 0.1445918,-0.273507 0.3156161,-0.535615 0.5,-0.78125 0.1843839,-0.245635 0.3737765,-0.473472 0.59375,-0.6875 0.439947,-0.428056 0.94291,-0.814526 1.5,-1.09375 0.278545,-0.139612 0.5734731,-0.246947 0.875,-0.34375 -0.2562018,0.100222 -0.4867109,0.236272 -0.71875,0.375 -0.00741,0.0044 -0.023866,-0.0045 -0.03125,0 -0.031933,0.0193 -0.062293,0.04251 -0.09375,0.0625 -0.120395,0.0767 -0.2310226,0.163513 -0.34375,0.25 -0.1061728,0.0808 -0.2132809,0.161112 -0.3125,0.25 -0.1779299,0.161433 -0.3474596,0.345388 -0.5,0.53125 -0.1075789,0.130255 -0.2183939,0.265285 -0.3125,0.40625 -0.025089,0.03838 -0.038446,0.08587 -0.0625,0.125 -0.064763,0.103032 -0.1302275,0.204517 -0.1875,0.3125 -0.1010083,0.194706 -0.2056748,0.415701 -0.28125,0.625 C 7.30454,21.30306 7.288911,21.3218 7.28125,21.34375 7.2494249,21.4357 7.2454455,21.530581 7.21875,21.625 7.1884177,21.731618 7.1483606,21.828031 7.125,21.9375 7.0521214,22.279012 7,22.635705 7,23 l 0,2 0,56 0,2 c 0,2.781848 2.2181517,5 5,5 l 2,0 68,0 2,0 c 2.781848,0 5,-2.218152 5,-5 l 0,-2 0,-56 0,-2 c 0,-0.364295 -0.05212,-0.720988 -0.125,-1.0625 -0.04415,-0.206893 -0.08838,-0.397658 -0.15625,-0.59375 -0.0077,-0.02195 -0.0233,-0.04069 -0.03125,-0.0625 -0.06274,-0.173739 -0.138383,-0.367449 -0.21875,-0.53125 -0.04158,-0.0828 -0.07904,-0.169954 -0.125,-0.25 -0.0546,-0.09721 -0.126774,-0.18835 -0.1875,-0.28125 -0.09411,-0.140965 -0.204921,-0.275995 -0.3125,-0.40625 -0.143174,-0.17445 -0.303141,-0.346998 -0.46875,-0.5 -0.01117,-0.0102 -0.01998,-0.02115 -0.03125,-0.03125 -0.138386,-0.125556 -0.285091,-0.234436 -0.4375,-0.34375 -0.102571,-0.07315 -0.204318,-0.153364 -0.3125,-0.21875 -0.0074,-0.0045 -0.02384,0.0044 -0.03125,0 -0.232039,-0.138728 -0.462548,-0.274778 -0.71875,-0.375 0.301527,0.0968 0.596455,0.204138 0.875,0.34375 0.55709,0.279224 1.060053,0.665694 1.5,1.09375 0.219973,0.214028 0.409366,0.441865 0.59375,0.6875 0.184384,0.245635 0.355408,0.507743 0.5,0.78125 0.14012,0.265048 0.276135,0.524729 0.375,0.8125 0.01041,0.03078 0.02133,0.06274 0.03125,0.09375 0.09046,0.278085 0.1388,0.579404 0.1875,0.875 C 89.95865,23.3493 90,23.665279 90,24 l 0,2 0,56 0,2 c 0,3.324 -2.676,6 -6,6 l -72,0 z"
       inkscape:connector-curvature="0"
       id="path3615"
       style="opacity:0.2;fill:url(#radialGradient2874);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
  </g>
  <g
     id="layer5"
     style="display:none">
    <path
       d="m 15.96875,22.53125 c -2.845903,0.0043 -5.433244,2.591597 -5.4375,5.4375 l 0,48.0625 c 0.0043,2.845903 2.591597,5.433244 5.4375,5.4375 l 64.0625,0 c 2.845903,-0.0043 5.433244,-2.591597 5.4375,-5.4375 l 0,-48.0625 c -0.0043,-2.845903 -2.591597,-5.433244 -5.4375,-5.4375 z"
       inkscape:connector-curvature="0"
       clip-path="url(#clipPath3860)"
       id="path3850"
       style="opacity:0.15;fill:url(#linearGradient3123);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3870)" />
  </g>
  <g
     id="layer6">
    <path
       d="m 77.78125,13.96875 c -0.270091,-0.01036 -0.558698,-0.0048 -0.875,0.03125 -0.04514,0.0051 -0.07898,-0.0068 -0.125,0 l -22.875,0 A 0.94004249,0.94004249 0 0 0 53.75,14 c -0.08984,0.01423 -0.120369,0.04227 -0.1875,0.0625 l -0.5625,0 c -2.166473,0 -3.9375,1.771027 -3.9375,3.9375 l 0,0.03125 A 0.94004249,0.94004249 0 0 0 50,18.96875 l 2.8125,0 c 0.249076,0.17452 0.441516,0.298856 0.59375,0.34375 l 0,63.71875 c -0.0411,2.60924 3.725096,3.563855 5,1.34375 L 58.4375,84.40625 58.5,84.3125 68.09375,70.75 c 3.356911,4.701517 6.65743,9.468984 10.09375,14.125 A 0.94004249,0.94004249 0 0 0 78.28125,85 c 1.748203,1.702311 4.750796,0.02545 4.5,-2.3125 l 0.03125,0 c -3.3e-5,-0.05208 3.3e-5,-0.10417 0,-0.15625 -0.01346,-21.373809 0.01674,-42.748507 -0.03125,-64.125 a 0.94004249,0.94004249 0 0 0 0,-0.0625 c -0.20656,-2.660968 -2.628403,-4.284103 -5,-4.375 z"
       transform="translate(0,-4)"
       id="path3859"
       style="opacity:0.05;fill:#000000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 53.90625,10.937502 c -1.315993,0.208508 -0.836624,1.8334 -0.888317,2.759534 0.05117,1.001443 1.644718,0.517651 1.325817,1.568763 0,21.255149 0,42.5103 0,63.765451 -0.02695,1.711107 2.525254,2.369215 3.306059,0.845429 3.481314,-4.917226 6.962627,-9.834453 10.443941,-14.751679 3.626016,5.049757 7.162777,10.199994 10.84375,15.1875 1.150285,1.120089 3.208531,-0.06181 2.9375,-1.614698 -0.01371,-21.427172 0.02747,-42.85577 -0.02063,-64.282047 -0.188199,-2.424435 -2.703064,-3.810081 -4.943316,-3.478253 -7.668269,0 -15.336539,0 -23.004808,0 z"
       inkscape:connector-curvature="0"
       id="path3850-4"
       style="opacity:0.1;fill:#000000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 54,12.705359 c 1.172304,0 2.116071,0.943768 2.116071,2.116072 l 0,50.080352 0,14.107142 11.991071,-16.928571 11.991071,16.928571 0,-2.116072 0,-11.99107 0,-50.080352 c 0,-1.172304 -0.943768,-2.116072 -2.116072,-2.116072 l -23.982141,0 z"
       inkscape:connector-curvature="0"
       id="path3202"
       style="opacity:0.3;fill:#000000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="M 54,15.9375 54,17.5 c 0.764674,0 1.34375,0.56165 1.34375,1.3125 l 0,50.09375 0,14.09375 A 0.77798469,0.77798469 0 0 0 56.75,83.4375 L 68.09375,67.40625 79.46875,83.4375 A 0.77798469,0.77798469 0 0 0 80.875,83 l 0,-2.09375 0,-12 0,-50.09375 c 0,-1.593758 -1.326316,-2.875 -2.90625,-2.875 L 54,15.9375 z"
       transform="translate(0,-4)"
       id="path3846"
       style="opacity:0.15;fill:#000000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 53,11.000002 c -1.662,0 -3,1.338 -3,3 l 0,0.03125 30,0 0,-0.03125 c 0,-1.662 -1.338,-3 -3,-3 l -24,0 z"
       inkscape:connector-curvature="0"
       id="rect3196"
       style="fill:#550000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 53,11.000002 c 1.662,0 3,1.338 3,3 l 0,5 0.09375,0 0,45.187498 0,14.125 12,-16.9375 11.96875,16.9375 0,-2.125 0,-12 L 80,14.000002 c 0,-1.662 -1.338,-3 -3,-3 l -1.03125,0 -22,0 -0.96875,0 z"
       inkscape:connector-curvature="0"
       id="rect3204"
       style="fill:#aa0000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 54.889005,11.000002 c 1.172304,0 3.116071,0.273584 3.116071,2.116071 L 58,71.609181 68.080358,58 l 9.880801,13.609181 0.0051,-58.493108 c -2.4e-5,-1.172303 -0.943792,-2.116071 -2.116096,-2.116071 l -20.961158,0 z"
       inkscape:connector-curvature="0"
       id="path3173"
       style="fill:#ff8f00;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 56.821429,11.000002 c 1.172304,0 3.116072,0.139692 3.116072,2.116071 l 0,52.556334 L 68.08036,54.369308 76,65.672407 76,13.116073 c 0,-1.172303 -0.94377,-2.116071 -2.11607,-2.116071 l -17.062501,0 z"
       inkscape:connector-curvature="0"
       id="path3175"
       style="fill:#d40000;fill-opacity:1;stroke:none;display:inline" />
    <path
       d="m 53,11.000002 c 1.662,0 3,1.338 3,3 l 0,5 0.09375,0 0,45.187498 0,14.125 12,-16.9375 11.96875,16.9375 0,-2.125 0,-12 L 80,14.000002 c 0,-1.595975 -1.24278,-2.868203 -2.8125,-2.96875 -0.06762,-0.01879 -0.12377,-0.0285 -0.1875,-0.03125 l -23.03125,0 -0.96875,0 z"
       inkscape:connector-curvature="0"
       id="path3177"
       style="fill:url(#linearGradient2600);fill-opacity:1;stroke:none;display:inline" />
  </g>
</svg>
As far as I can understand, the SVG is correct while the problem should be the renderer because the post processed SVG is 20 times bigger in size, and if I inspect the xml I obtain something like:
(this is just a little chunk, I couldn't copy and paste the whole xml because I got one strange error from BB)

Code: Select all

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="96" height="96">
  <circle cx="0" cy="0" r="1" fill="white"/>
  <circle cx="1" cy="0" r="1" fill="white"/>
  <circle cx="2" cy="0" r="1" fill="white"/>
  <circle cx="3" cy="0" r="1" fill="white"/>
  <circle cx="4" cy="0" r="1" fill="white"/>
  <circle cx="5" cy="0" r="1" fill="white"/>
  <circle cx="6" cy="0" r="1" fill="white"/>
  <circle cx="7" cy="0" r="1" fill="white"/>
  <circle cx="8" cy="0" r="1" fill="white"/>
  <circle cx="9" cy="0" r="1" fill="white"/>
  <circle cx="10" cy="0" r="1" fill="white"/>
  <circle cx="11" cy="0" r="1" fill="white"/>
  <circle cx="12" cy="0" r="1" fill="white"/>
  <circle cx="13" cy="0" r="1" fill="white"/>
  <circle cx="14" cy="0" r="1" fill="white"/>
  <circle cx="15" cy="0" r="1" fill="white"/>
  <circle cx="16" cy="0" r="1" fill="white"/>
  <circle cx="17" cy="0" r="1" fill="white"/>
  <circle cx="18" cy="0" r="1" fill="white"/>
  <circle cx="19" cy="0" r="1" fill="white"/>
  <circle cx="20" cy="0" r="1" fill="white"/>
  <circle cx="21" cy="0" r="1" fill="white"/>
  <circle cx="22" cy="0" r="1" fill="white"/>
  <circle cx="23" cy="0" r="1" fill="white"/>
  <circle cx="24" cy="0" r="1" fill="white"/>
  <circle cx="25" cy="0" r="1" fill="white"/>
  <circle cx="26" cy="0" r="1" fill="white"/>
  <circle cx="27" cy="0" r="1" fill="white"/>
  <circle cx="28" cy="0" r="1" fill="white"/>
  <circle cx="29" cy="0" r="1" fill="white"/>
  <circle cx="30" cy="0" r="1" fill="white"/>
  <circle cx="31" cy="0" r="1" fill="white"/>
  <circle cx="32" cy="0" r="1" fill="white"/>
  <circle cx="33" cy="0" r="1" fill="white"/>
  <circle cx="34" cy="0" r="1" fill="white"/>
  <circle cx="35" cy="0" r="1" fill="white"/>
  <circle cx="36" cy="0" r="1" fill="white"/>
  <circle cx="37" cy="0" r="1" fill="white"/>
  <circle cx="38" cy="0" r="1" fill="white"/>
  <circle cx="39" cy="0" r="1" fill="white"/>
  <circle cx="40" cy="0" r="1" fill="white"/>
  <circle cx="41" cy="0" r="1" fill="white"/>
  <circle cx="42" cy="0" r="1" fill="white"/>
  <circle cx="43" cy="0" r="1" fill="white"/>
  <circle cx="44" cy="0" r="1" fill="white"/>
  <circle cx="45" cy="0" r="1" fill="white"/>
  <circle cx="46" cy="0" r="1" fill="white"/>
  <circle cx="47" cy="0" r="1" fill="white"/>
  <circle cx="48" cy="0" r="1" fill="white"/>
  <circle cx="49" cy="0" r="1" fill="white"/>
  <circle cx="50" cy="0" r="1" fill="white"/>
  <circle cx="51" cy="0" r="1" fill="white"/>
  <circle cx="52" cy="0" r="1" fill="white"/>
  <circle cx="53" cy="0" r="1" fill="white"/>
  <circle cx="54" cy="0" r="1" fill="white"/>
  <circle cx="55" cy="0" r="1" fill="white"/>
  <circle cx="56" cy="0" r="1" fill="white"/>
  <circle cx="57" cy="0" r="1" fill="white"/>
  <circle cx="58" cy="0" r="1" fill="white"/>
  <circle cx="59" cy="0" r="1" fill="white"/>
  <circle cx="60" cy="0" r="1" fill="white"/>
  <circle cx="88" cy="95" r="1" fill="white"/>
  <circle cx="89" cy="95" r="1" fill="white"/>
  <circle cx="90" cy="95" r="1" fill="white"/>
  <circle cx="91" cy="95" r="1" fill="white"/>
  <circle cx="92" cy="95" r="1" fill="white"/>
  <circle cx="93" cy="95" r="1" fill="white"/>
  <circle cx="94" cy="95" r="1" fill="white"/>
  <circle cx="95" cy="95" r="1" fill="white"/>
</svg>
which seems quite weird. What is funny is that I remember last year I have been using IM to change the hue of some SVG and I didn't experience this issue. Is there something am I missing?

Once again, thank you in advance.

Re: Changing hue just for one channel

Posted: 2014-11-10T15:36:07-07:00
by snibgo
BubbleBobble wrote:... and if I inspect the xml I obtain something like:
What XML? Where did that come from?

When I convert your icon SVG it looks fine, a blue folder with orange stripe with thin white border.

Re: Changing hue just for one channel

Posted: 2014-11-16T14:39:44-07:00
by BubbleBobble
The SVG used in these example is this one: http://www.fuina.it/pub/users/xfce-italia/bookmark.svg

If I convert a SVG to SVG using:

Code: Select all

convert bookmark.svg out.svg
I would expect to obtain the same SVG, instead I get this weird SVG file: http://www.fuina.it/pub/users/xfce-italia/out.svg
I have found out that IM uses "delegates" to handle different picture file formats, in particular SVG is handled by:

Code: Select all

convert -list delegate | grep svg

svg =>          "rsvg-convert" -o "%o" "%i"
If I convert a SVG to SVG using directly "rsvg-convert" I can get a correct SVG only if I use the -f option:

Code: Select all

rsvg-convert -f svg -o out.svg bookmark.svg
If I modify /etc/ImageMagick/delegates.xml in order to execute the -f option automatically when using IM:

Code: Select all

rsvg-convert -f svg -o %o %i
the result doesn't change, still I get the same weird SVG.
I tried to download the source and compile IM, the result doesn't change.
I tried to convert a SVG to SVG using the Windows version and I get a correct SVG, so the problem seems a bug in the Linux version.

At this time I am nearly to give up but the last idea is to try some older versions and see or eventually open a bug.

Do u have any suggestion?

Thank you again for yr precious help and patience.

Re: Changing hue just for one channel

Posted: 2014-11-16T14:58:10-07:00
by snibgo
ImageMagick is a raster processor, not a vector processor.

SVG is (almost always) vector.

"convert in.svg out.svg" will rasterise the vectors, converting them to pixels. Then it writes each pixel as a vector circle. This is correct behaviour, but not normally useful.
BubbleBobble wrote:Do u have any suggestion?
I don't know what you want to do. If you simply want to change colours within the SVG file, without rasterising it, IM is the wrong tool.

Re: Changing hue just for one channel

Posted: 2014-11-17T00:53:19-07:00
by BubbleBobble
Yes exactly. You know, not being an image processing expert, I took a while to understand that.
My aim was to apply the same script to change the hue for PNG also for SVG.
At this point I will make some experiments writing a python script in order to mix IM and maybe Inkscape libraries.

Thank you again.