2

I would like to convert the purple color in this image:

enter image description here to blue such as:

enter image description here

Is there an easy way to accomplish this? If not, is there an easy way to replicate the same effect?

Thanks

Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
Alede
  • 25
  • 3

1 Answers1

2

You could separate the image in R,G and B channels, and replace the red channel by zeroes, leaving only the G and B channels.

Example in Mathematica:

i = Import["http://tinyurl.com/3wqklof"];
ColorCombine@{ImageSubtract[#[[1]], #[[1]]], #[[2]], #[[3]]} &@ ColorSeparate@i

enter image description here

Edit

Or, If you need an "exact" blue image, separate in the "HSB" color space, replacing all non zero values of the H matrix by 2/3 (blue), leaving the S and B components untouched.

Example:

ColorCombine[{Image[2/3 ImageData@ImageAdd[#[[1]], #[[1]]]], #[[2]], #[[3]]} &@
              ColorSeparate[i, "HSB"], "HSB"]

enter image description here

Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
  • Genius! Thank you for also appending an explanation with code. However, why is the output smaller/degraded as compared to the original input? – Alede Aug 11 '11 at 05:04
  • @Alede I used the default Mathematica's output image size. Plain old laziness. – Dr. belisarius Aug 11 '11 at 05:25