# Method Image.Image()->hsv_to_rgb()

Method hsv_to_rgb

  ```object`` rgb_to_hsv()`
  ```object`` hsv_to_rgb()`

Description

  Converts RGB data to HSV data, or the other way around. When converting to HSV, the resulting data is stored like this: pixel.r = h; pixel.g = s; pixel.b = v;

  When converting to RGB, the input data is asumed to be placed in the pixels as above.

  original | ->hsv_to_rgb(); | ->rgb_to_hsv();
  tuned box (below) | the rainbow (below) | same, but rgb_to_hsv()

  HSV to RGB calculation:

      in = input pixel
      out = destination pixel
      h=-pos*c_angle*3.1415/(float)NUM_SQUARES;
      out.r=(in.b+in.g*cos(in.r));
      out.g=(in.b+in.g*cos(in.r + pi*2/3));
      out.b=(in.b+in.g*cos(in.r + pi*4/3));

  RGB to HSV calculation: Hmm.

  Example: Nice rainbow.

       object i = Image.Image(200,200);
       i = i->tuned_box(0,0, 200,200,
                        ({ ({ 255,255,128 }), ({ 0,255,128 }),
                           ({ 255,255,255 }), ({ 0,255,255 })}))
            ->hsv_to_rgb();

Returns

  the new image object