Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In a picture, there are many different colors. How can I just want to find the position of one color. In the following picture, if I would like to find the coordinates of the position of blue, how can I achieve that? Thank you very much! enter image description here

share|improve this question
By Blue you mean RGBColor[0,0,1]? Is PixelValuePositions ok? –  Kuba Oct 31 '13 at 7:17
@Kuba I think that is a good answer. image = Import["1wEvU.jpg"]; PixelValuePositions[image, Blue, 0.4] gave me {{1605, 810}, {1606, 810}, {1604, 809}, {1605, 809}, ... –  Nasser Oct 31 '13 at 7:22

1 Answer 1

up vote 13 down vote accepted
image = Import["http://i.stack.imgur.com/1wEvU.jpg"];

Look for anything within 0.3 of Blue:

pv = PixelValuePositions[image, Blue, .3]

{{1614, 784}}

Just one pixel is that close to pure Blue. To display it:

HighlightImage[image, pv, "HighlightColor" -> White, 
  Method -> {"DiskMarkers", 20}]

It's over by the Balloon(?).


share|improve this answer
Ooh, I've never come across HighlightImage before. +1, but why is it community wiki? –  Simon Woods Oct 31 '13 at 10:35
@SimonWoods :) Too long to be yet another comment-as-answer, but didn't want to snatch credit away from commenters... –  cormullion Oct 31 '13 at 10:37
@cormullion Can PixelValuePositions be used to find some "strange" color? –  KathyLL Oct 31 '13 at 21:35
@kathyLL any color will work, if you know its RGB values. But strangeness needs defining! :) –  cormullion Oct 31 '13 at 21:51
@cormullion Thanks a lot! –  KathyLL Nov 1 '13 at 18:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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