1
$\begingroup$

I have an image,

Imported image

I want to rotate the hue of the image and export the result. Eventually I will loop this to produce ~360 images covering the entire cycle. I feel like this should be easy with Mathematica but I am struggling.

So far I have tried:

conv[pix_,i_]:={Mod[pix[[1]]+(i/360.),1.0],pix[[2]],pix[[3]]}
convL2[row_,i_]:=conv[#,i]&/@row;

Table[Image[convL2[#, i] & /@ ImageData[ColorConvert[base, "HSB"]]], {i, 0, 360,120}]

Which produces these images,

Not Correct

Which clearly aren't quite right. Does anyone have any nice methods to achieve this? Thanks.

$\endgroup$
1
  • 1
    $\begingroup$ ImageApply[conv[#, 120] &, ColorConvert[base, "HSB"]] $\endgroup$
    – user484
    Oct 24, 2016 at 3:09

1 Answer 1

1
$\begingroup$

Rahul has posted an answer in the comments to my question that solves the problem. I am posting it here to mark the question as closed.

conv[pix_,i_]:={Mod[pix[[1]]+(i/360.),1.0],pix[[2]],pix[[3]]}
Table[
    ImageApply[conv[#, i] &, ColorConvert[base, "HSB"]],
    {i,0,360,120}
]

The missing component was ImageApply, which Maps a function over every pixel of an image.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.