From: Alex Fenton Date: 2006-07-26T03:05:08+09:00 Subject: Re: WxRuby: Opening and Displaying PNG images on a window kpeng1 wrote: > Hello, > > I am still pretty new to wxwidgets and I am trying to learn as fast as > possible. A good place to start is among the samples that come with wxruby and wxruby2. These give short illustrations of how to use a lot of the classes. > I have been looking at the Image, ImageList and PNGHandler classes, but > I cannot seem to get anything to work. I cannot even declare a handler. There is a sample that shows how to load a PNG image. Something like: class MyFrame < Wx::Frame def initialize(title) super(nil, -1, title) evt_paint { on_paint } image = Wx::Image.new('paperclip.png') # load the image from the file @bitmap = Wx::Bitmap.new(image) # convert it to a bitmap, ready for drawing with end def on_paint paint do | dc | dc.clear dc.draw_bitmap(@bitmap, 0, 0, false) # draw the end end end > At this point I just want png thumbnails to display in a window. Wx::Image seems to have 'resize' and 'rescale' methods among others, though I haven't ever tried these. All the methods that are (potentially) available can be seen at http://www.wxwindows.org/manuals/2.6.3/wx_wximage.html#wximage . You could also use another package to create thumbnails, eg RMagick. > Any help or hints would be appreciated. Another source of help is the wxruby mailing list cheers alex