|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using grep to compare JPEGs
Hi, I'm not sure if this is the right place but I'm a newb so it seemed right. I'm trying to write some code to organize JPEGs. Its a long story, but essentially, I need the program to tell me whether a particular jpeg is of 1) a sheet of paper (lets say its solid pink that takes up the entire frame) or 2) whether the image is of anything other than a piece of pink paper.
I assumed I would need to learn something like Python to do the comparison, but a friend suggested that I use the UNIX "grep" command. The problem I'm having is finding any string that represents "pink." Can anyone help me out? |
| Sponsored Links | ||
|
|
|
#2
|
||||
|
||||
|
i don't think that "grep" is the right tool for you... and maybe no "scripting" language is. but i don't know python or other "higher" languages.
|
|
#3
|
||||
|
||||
|
JPEGs are binary data, there is no string in there representing pink. There are only the discreet transformations for each pixel and color (Red, Green, Blue), so unlike bitmaps, you can't even determine the color by looking at a certain position without decoding it first. Also, if you want to know more that just if an image contains "pink", you'll have to do image/pattern recognition.
grep, on the other hand, is intended to handle plain text (in various encodings if possible), and wouldn't even know what to do with pictures. |
|
#4
|
||||
|
||||
|
Interesting question. You could use jpegtopnm (part of the netpbm toolkit) to convert to PPM Type 3 format and then write a script to check the contents using some sort of heuristics such as CCL (connected component labeling)
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to grep and compare timestamp in a file with the current date | achu | AIX | 1 | 05-25-2009 09:05 AM |
| how to grep and compare timestamp in a file with the current date | achu | AIX | 1 | 05-25-2009 08:20 AM |
| how to grep and then to compare | ravi18s | Shell Programming and Scripting | 5 | 05-15-2009 06:38 AM |
| Compare 2 array files using grep | lanna001 | UNIX for Dummies Questions & Answers | 2 | 04-22-2009 09:32 AM |
| compare grep? | k@ssidy | UNIX for Dummies Questions & Answers | 7 | 06-15-2005 11:59 AM |