Sign in with
Sign up | Sign in
Your question

Illumination Needed On Luminance!

Last response: in Digital Camera
Share
Anonymous
January 26, 2005 5:57:32 AM

Archived from groups: rec.photo.digital (More info?)

I need to programatically create a table, for any given JPEG file,
that consists of the RGB values for each pixel. The resulting table
would look something like this:

Pixel Red Green Blue
1 255 255 100
2 234 234 92
3 45 0 45
.
.
.
n

Attached is a very simple JPEG that I am using to cut my teeth on.
Looking for any suggestions as one might do this. I would even
consider a different file format if some of you think that would be
better. Any and all suggestions welcome.

Thanks.
Anonymous
January 26, 2005 5:57:33 AM

Archived from groups: rec.photo.digital (More info?)

If it was just a planar bitmap or something you could just read the
byte values directly.
Anonymous
January 26, 2005 5:57:33 AM

Archived from groups: rec.photo.digital (More info?)

secheese wrote:
> I need to programatically create a table, for any given JPEG file,
> that consists of the RGB values for each pixel. The resulting table
> would look something like this:
>
> Pixel Red Green Blue
> 1 255 255 100
> 2 234 234 92
....

I've never done anything like this before so all I can do is speculate
on solutions.

Direct conversion of a JPEG would be hard because JPEG doesn't store
individual pixels. It stores values that can be decompressed into
individual pixels. So you either need to:

1. Find a decompression library - there are some for different
languages.
or
2. Convert to an uncompressed format first.

Windows bitmap (.bmp) might be easy to parse. Some others might be
much easier than JPEG too.

Alan
Related resources
Anonymous
January 26, 2005 5:57:33 AM

Archived from groups: rec.photo.digital (More info?)

Use Irfanview (www.irfanview.com) to save the file as a windows bitmap
after altering the color ratio using the Enhance Colors option and
dropping out the R&G, then R&B then B&G. I believe that Irfanview has
a Batch Conversion option that you can set the colors in thereby
allowing you to process hundreds of files as easily as one, and the BMP
format is very similar to what you have described (also, not lossy like
jpeg)

Programatically, get a library that acts as a codec for JPEGs, and then
handle it as a bitmap. For example, you can use Delphi to write a
program that will give you access to the pixel colors on a pixel by
pixel basis.

keithp@malibugroup.com
Anonymous
January 26, 2005 6:01:24 AM

Archived from groups: rec.photo.digital (More info?)

begin 644 perfect_field.jpg
M_]C_X``02D9)1@`!`0$`2`!(``#_VP!#``,"`@,"`@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ZM'8PZK>QZ9<7%YIJ3.MK<7=NL$TL08['>-7<(Q7!*AW`)
M(#-C)+VRAM;:p EBO[>\>YA,LL,*R!K5A(Z>7)O106*HLF4+KMD0;@P95N:5-
MI@M+NRU.$1>:/M$6I6\33W$3I#-Y<`3SDC\N61XA([!G01ADSAHY`HR:***`
M)4%Q/;LJB22"#,K*,E8\E5+'L,G8,_0>E69M15]3O;RVM+2PCF,I2S1&EBA5
M\KL3S2[?*&.UF8L-H.[<`:HT\QJ(4?S%+%BIC`.Y0`,$\8P<G&#GY3D#C(G9
MZJY5DUITWU\^G^6O5^EN\TZ/3X72><&](@EBCMVCFB:*2,N2TB.=KKF,%,$@
MEPVQD*F>XM;C2M"A2]T3R?[4\N^L=4N$F1W@1IX7$/S"-XFE5E9BK$/;;59<
M2*V<_EO,_EYBBR2@D;<0.P)`&3VS@?A2PK`T<YEDD214!A5(PP=]RY#$L-HV
M[CD!N0!CDD'*TKWW(6[U(J*5W:1V9F+,QR6)R2:*!E^Q!M=.NK^#58[2[1UM
MELT,JSSQ2QRB1U95V;%"A'#.&/G*%5QO*PV5E#=6U_++?V]F]M")8H9ED+73
M&1$\N/8C`,%=I,N47;&XW%BJM5HH`MZE=/J=U/J$S6ZW%U/)))#;0+`B$D-E
M8T58T4EB`J``;<8`QEVD3:=#J%J^J6MU>6*W$;7$-G<K;R20`_O$1VCD".PX
M5RK!3R4;I5*B@;=]E8M:MJ<VM:K>ZA<);QW%W,]Q(EI;1VT*LS%B$BC54C7)
/X1%"J,````455HH$?__9
`
end
Anonymous
January 26, 2005 6:01:24 AM

Archived from groups: rec.photo.digital (More info?)

Hmmm... forgot the attachment! :/  Anyway... here it is!
Anonymous
January 26, 2005 6:45:02 AM

Archived from groups: rec.photo.digital (More info?)

1. you can't post attachments in a binary newsgroup, give a url address to a
webpage where the photo is. (ie put it on a webpage then post a link to it).

2. What the hell does "programatically" mean?


"secheese" <sec@nbnet.nb.ca> wrote in message
news:vj0ev05mqu4u8b0nujivnlvsptc4jb6coh@4ax.com...
>I need to programatically create a table, for any given JPEG file,
> that consists of the RGB values for each pixel. The resulting table
> would look something like this:
>
> Pixel Red Green Blue
> 1 255 255 100
> 2 234 234 92
> 3 45 0 45
> .
> .
> .
> n
>
> Attached is a very simple JPEG that I am using to cut my teeth on.
> Looking for any suggestions as one might do this. I would even
> consider a different file format if some of you think that would be
> better. Any and all suggestions welcome.
>
> Thanks.
>
>
Anonymous
January 26, 2005 10:45:48 AM

Archived from groups: rec.photo.digital (More info?)

NOsecSPAM@nbnet.nb.ca writes:
>I need to programatically create a table, for any given JPEG file,
>that consists of the RGB values for each pixel. The resulting table
>would look something like this:

One fairly simple approach, if you have a C compiler handy:

- Get a copy of the Independent JPEG Group software. The "djpeg"
command will decode a JPEG image into the uncompressed PPM format.
There are two different PPM image formats, one ASCII and one binary.
Maybe djpeg has an option to write ASCII directly; if so you are almost
done. Otherwise, get a copy of the PBMPLUS or NETPBM packages, which
will convert from binary to ASCII format.

Then just read the file into a text editor. You'll find that there is a
very simple header of a few lines, then the RGB pixel data in plain
printable text.

Dave
Anonymous
January 26, 2005 2:40:12 PM

Archived from groups: rec.photo.digital (More info?)

On Wed, 26 Jan 2005 03:45:02 -0000, "Canongirly" <me@me.com> wrote:

>1. you can't post attachments in a binary newsgroup, give a url address to a
>webpage where the photo is. (ie put it on a webpage then post a link to it).
>
>2. What the hell does "programatically" mean?

No offence, but if you have to ask, then you likely can't help me. :) 
January 27, 2005 8:38:30 AM

Archived from groups: rec.photo.digital (More info?)

secheese wrote:
> I need to programatically create a table, for any given JPEG file,
> that consists of the RGB values for each pixel. The resulting table
> would look something like this:
>
> Pixel Red Green Blue
> 1 255 255 100
> 2 234 234 92
> 3 45 0 45
> .
> .
> .
> n
>
> Attached is a very simple JPEG that I am using to cut my teeth on.
> Looking for any suggestions as one might do this. I would even
> consider a different file format if some of you think that would be
> better. Any and all suggestions welcome.
>
> Thanks.
>
>

If you have access to Perl & Image::Magick module then it is
straightforward. Note, this method is *not* the most efficient.

To access the RGB values of a particular pixel in Imagemagick you could
do worse than this;

@pixel = split /,/,$image->Get("pixel[$x,$y]")

where $x and $y are the x,y coords. This function returns a comma
separated sting of 4 values, the R,G,B and opacity (off the top of my
head). In the example above I separated the 4 values into an array such
that;

$pixel[0] = R
$pixel[1] = G
$pixel[2] = B

So by using the above on a double loop (rows and cols) you could print
out the values you mention above.

As I said, it's not an efficient way of access the RGB values.

Adey
Anonymous
January 28, 2005 1:12:02 AM

Archived from groups: rec.photo.digital (More info?)

On Thu, 27 Jan 2005 05:38:30 +0000 (UTC), Zorg <no.em@il.thanks>
wrote:

Thanks.
!