Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 11, 2013, 09:14 AM   #1
BobRon
macrumors newbie
 
Join Date: Oct 2012
Image Magick Problem

I am using imagemagick to detect the color of one pixel of an image. I need a program in bash that matches the discovered hex cold to the nearest of 11 pre-definded pixels. Is this possible? Or do i need to write if/else statements for every possible tint of purple.
BobRon is offline   0 Reply With Quote
Old Aug 11, 2013, 08:34 PM   #2
mwb
macrumors newbie
 
Join Date: Jul 2011
Once you have defined a suitable a way of measuring distance between colours, all you need to do is loop through your 11 pre-defined pixels and choose the (or 'a' in some cases) closest one. Not sure why you'd dream of creating millions if/else statements!

Depending on your overall goal, you might want to try Image Magick's C++ API. Furthermore, if you're just looking up pixel values then maybe you should be using OpenImageIO.
mwb is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
bash, imagemagick, pixel, tint

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:08 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC