pixel to file

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Elmit
Posts: 2
Joined: 2014-01-08T18:07:23-07:00
Authentication code: 6789

pixel to file

Post by Elmit »

It is not an IM question, but I hope that somebody can give me a hint where to start.

I have to create a file for a machine, which is an "image" of 240 x 32 pixels.
The machine reads the pixels in columns from top to bottom
(For this I think to turn a picture by 90 degree and flip it, then the pixel order left to right and top to bottom will be converted to top to bottom and left to right)

The pixel has only 3 bits !!! for RGB (000, 001, 010, 011, 100, 101, 110, 111)

The resulting file includes ONLY the pixels (binary).

I need to create/display this file on a web page first and then convert it to the above structure.

Which image format would be closest to that task? (bmp ?)

I looked at the bmp description and wonder if I could just cut off the headers.
How can I convert the color depth to only one value of RGB?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pixel to file

Post by snibgo »

Elmit wrote:How can I convert the color depth to only one value of RGB?
You can do that in IM:

Code: Select all

convert in.png -posterize 2 out.png
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: pixel to file

Post by glennrp »

Code: Select all

convert rose: -depth 1 -compress none rose.ppm
Then use your text editor to change all of the 255's to 1 and remove the header.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pixel to file

Post by snibgo »

glenrp wrote:convert rose: -depth 1 -compress none rose.ppm
Brilliant. Why didn't I think of that? I'll get the hang of IM one day ...
snibgo's IM pages: im.snibgo.com
Post Reply