Re: [Fxruby-users] Converting Image Formats
Status: Inactive
Brought to you by:
lyle
|
From: Lyle J. <jl...@cf...> - 2003-12-17 15:57:23
|
Carsten Eckelmann wrote:
> is it possible to load a BMPImage and save it as a JPEG, just by using
> the FOX library? I couldn't find this out by looking at the API.
Good question (and the answer is yes). Load the BMP image from a file
using code like this:
img = FXBMPImage.new(getApp(), nil,
IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)
FXFileStream.open("image.bmp", FXStreamLoad) do |stream|
img.loadPixels(stream)
end
and then save it as a JPEG using code like this:
FXFileStream.open("image.jpg", FXStreamSave) do |stream|
img.savePixels(stream)
end
Hope this helps,
Lyle
|