On Friday 09 March 2001 14:30, Dave Thomas wrote:
> Phlip <phlip_cpp / my-deja.com> writes:
> > Ruby-san:
> >
> > My mom got my kid a NickClick Mattel toy digital camera - it comes with a
> > goofy image program over-written for Windows 98.
> >
> > I only have Linux computers in my life.
> >
> > I found a program on the 'net that reads the camera's dinky protocol and
> > writes JPG and other formats. I want to script a program that displays
> > all these pictures in windows, with a button saying "Acquire".
> >
> > Because this looked too easy in an older language, I decided to make it
> > harder by using this project to learn Ruby.
> >
> > But not so hard I have to learn the guts of JPEG.
> >
> > How do I read a file containing a common graphics and display it on a GTK
> > (or Tk) window?
>
> There's some basic code from the book that does this with Tk at
>
>    http://www.pragmaticprogrammer.com/ruby/samples/smp161.html
>
> this might be a start. I've never used a TkPhotoImage with a .jpg
> though, so I'm not sure if the support if there. You may have to use
> gifs if not.
>

The limitation of Tk is that it natively supports gif, but not jpg or png 
(although there are add on libraries that do)

However, since you are rinning Linux, Gtk+ works great on that (windows, 
so-so, Linux, great)

The Ruby GTK library has a viewer program in the /samples/gdkimlib subdir of 
the distribution folder named rbview which reads jpg and png (and gif) very 
nicely. Ruby GTK can be found on RAA.

Now...you can play with this *after you tire of looking at pictures) and 
maybe come up with a Ruby script to handle the whole transfer to viewing 
sequence. Now wouldn't be too early to get your involved in Ruby programming 
for that matter, either :-)

Hope this helps.

Regards,

Kent Starr
elderburn / mindspring.com