Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] XBM to GIF conversion

Hi,

I am writing (intermittantly when I have time) two addons to the FileFormat class XBMFileFormat and XPMFileFormat to read X-Windows XBM & XPM files. They both read and display fine and I am now checking that they can save as well. Now they save fine in their own formats but I am having trouble saving across formats. When I save an XBM as a GIF the image is unreadable, however when I save the GIF as a different GIF the same thing happens. I am assuming that this is possible. Here is a snippet of my test code.

   protected ImageLoader loaderXBM = new ImageLoader();
   protected ImageLoader loaderGIF = new ImageLoader();

ImageData[] imageDataGif = loaderGIF.load("/workspace/graphics/harp.gif");
   ImageData[] imageDataXBM = loaderXBM.load("/workspace/test/harp.xbm");

   loaderXBM.save("/workspace/test/harp_xbm.gif", SWT.IMAGE_GIF);
   loaderGIF.save("/workspace/test/harp_gif.gif", SWT.IMAGE_GIF);

The two images are both the same, the file harp.xbm and harp.gif (which was converted from the xbm using gimp) and their ImageData objects are identical except for their types.

Any suggestions would be appreciated.

Regards
Simon Meaden


Back to the top