Link to home
Start Free TrialLog in
Avatar of jonassondaniel
jonassondaniel

asked on

Convert to bmp

I need to convert images to bmp to be able to set them as wallpaper... Is there a freeware component that does the job or what should I do? I need to be able to convert from the most usual image formats: .BMP|.GIF|.JPG|.JPEG|.EMF|.WMF
Avatar of zeko
zeko

try this (NOTE! try to find component for GIF Images, it's
called TGIFImage 2.2, I am not sure for the URL)

var JPG:TJPEGImage;
    BMP:TBitmap;
begin
 JPG:=TJPegImage.Create;
 JPG.LoadFromFile('test.jpg');
 BMP:=TBitmap.Create;
 BMP.Assign(JPG);
 BMP.SaveToFile('test.bmp');
end;

Cheers, Zeko
Avatar of jonassondaniel

ASKER

like I said.. I need to convert from more than jpg files.
I have the TGifImage component so the gif shouldn't be a problem either. Thanks for the jpg-code. It would be great if you could help me with the other formats as well. otherwise I'll give you your point anyways.. :-)
This support all formats except GIF:

var p: TPicture;
begin
  p := TPicture.Create;
  p.LoadFromFile('image.jpg'); //can be jpeg, jpg, bmp, ico, emf or wmf
  Canvas.Draw(10, 10, p.Graphic);
  p.Free;
end;


Epsylon.
If you want to save it to a bitmap use this:


var p: TPicture;
    b: TBitmap;
begin
  b := TBitmap.Create;
  p := TPicture.Create;
  p.LoadFromFile('mailusa.wmf');
  b.Width := p.Graphic.Width;
  b.Height := p.Graphic.Height;
  b.Canvas.Draw(0, 0, p.Graphic);
  b.SaveToFile('bitmap.bmp');
  p.Free;
  b.Free;
end;


Eps.
Hmmm... I'm a little slow... Could you change the example to open a wmf and then save it as a bmp? sorry...
:-)

you're quick!

thanks! propose answer...
Reject the current answer first   :o)
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks!
Thank you too for the points!

Next question  :o)