How to get the native pixel format?

How to get Pixel Color values as part of a bash script?

  • I was wondering if there is a linux command-line utility that could be called in a bash script to return a pixel color value that could then be used as a variable in the script. I just want it from the screen in general, (i know how to take values from stored images...) I'm hoping that there exists a cleverer solution than taking an image of the screen and processing that, as it needs to work fairly quickly. (i'm writing a script to survey the range of colors displayed by pixels over a given period of time, and activity, in order to settle a bet...long story...) I'd like to stick with utilities that can be used in a bash script, because i've already written the activity tracking part in bash, and i don't want to port to a different language if i can help it. Ideally somebody knows about a simple library written for the terminal with a command like: getpixelcolor( x, y ) that could be called as part of a loop and would return a numeric color value in some usable format format. Also, I could probably write my own utility if I could find out how to get raw color information from the graphics drivers....I'm using an Nvidia 6800gt with Ubuntu 9.04 via gnome. (i don't know anything about driver operation... Any help would be greatly appreciated, and I apologize for being technically vague. If i knew exactly what I was talking about, I wouldn't need to ask the question =)

  • Answer:

    I would look into the code of whatever is being called when you hit the screen capture button. It has to have some way of capturing the display to work. To what little I know about these sorts of things, this function seems like something that would more likely be found in a graphics library than a dedicated utility.

Jason Bourne at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.