Newbie Question

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
GaryMansperger
Posts: 1
Joined: 2019-02-09T11:41:57-07:00
Authentication code: 1152

Newbie Question

Post by GaryMansperger »

I am a complete newbe to image processing. I want to convert an array of pixels from a jpg image. I currently have an physical array made from ws2812 led strips. the current size is 10 by 30 pixels (very low resolution!) but eventually I will make it much larger.

I need to take an image and convert it to an array of rgb values. I will deal with scaling at some point but first I want to be able to create the array that I can then write to the LEDs from an Arduino program. What would be perfect would be something like pic(x,y) value = 64, 255,128. Of course there are many ways to express the value and as long as I can send it to the LEDs (using FastLED) I am very happy!

I expect to make the array off line from the Arduino on a windows pc. Then it will be written to a file on a SD card. The Arduino program will read the file and write it to the LEDs.

I see examples of creating an image from the array but not creating the array from an image.

Any help would be greatly appreciated.
Thank you.
Gary
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Newbie Question

Post by fmw42 »

I have moved this question, since it has nothing to do with my scripts.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Newbie Question

Post by snibgo »

You want a format for RGB images that IM can write, and that a simple Arduino program can read. Is that right?
What would be perfect would be something like pic(x,y) value = 64, 255,128.
The "txt:" format does that. Text lines, one line per pixel. But do you really want to parse text lines? PPM is easier to read, with one text number or binary byte per channel per pixel.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Newbie Question

Post by fmw42 »

PPM files can be binary or text format from the NetPPB package with a few simple header lines and then the format as rgb triplets. See http://netpbm.sourceforge.net/doc/ppm.html
Post Reply