Page 1 of 1

How to convert SWF to JPEG ?

Posted: Sun Jan 24, 2010 4:27 pm
by liewjp
Hello,

I've saw your sample to convert SWF to bitmap as below :

Code: Select all

procedure TMainForm.ButtonSaveAsBitmapClick(Sender: TObject);
var
  Bitmap: TBitmap;
  Picture: TPicture;
begin
  Picture := TPicture.Create;
  Bitmap := FlashPlayerControl1.CreateFrameBitmap;
  Picture.Bitmap := Bitmap;
  if SaveAsBitmapDialog.Execute then
  begin
    Picture.SaveToFile(SaveAsBitmapDialog.FileName);
  end;
  Bitmap.Free;
  Picture.Free;
end;


I was wondering what technique is used to convert SWF to JPEG ?

Is there any function like FlashPlayerControl1.CreateFrameJPEG as below :

Code: Select all

procedure TMainForm.ButtonSaveAsJPEGClick(Sender: TObject);
var
  Jpg : TJpegImage;
  Stream: TMemoryStream;
begin
  Jpg := FlashPlayerControl1.CreateFrameJPEG;
  Stream := TMemoryStream.Create;
  try
    Jpg.SaveToStream(Stream);
    Stream.Position := 0;
    //Load the Blob field from the stream
    TBlobField(oTable.fieldbyname('Image')).LoadFromStream(Stream);
  finally
    jpg.Free;
    Stream.Free;             
end;


:D

Thanks.

Regards,
Steven Liew

Re: How to convert SWF to JPEG ?

Posted: Mon Jan 25, 2010 7:29 am
by Softanics
Thank you for your question.

Could you please try the following:

Code: Select all

procedure TMainForm.ButtonSaveAsJPEGClick(Sender: TObject);
var
  Bitmap: TBitmap;
  Jpg : TJpegImage;
  Stream: TMemoryStream;
begin
  Bitmap := FlashPlayerControl1.CreateFrameBitmap;

  Jpg := TJpegImage.Create;
  Jpg.Assign(Bitmap);

   ...

end;


Thank you.

Posted: Mon Jan 25, 2010 11:13 am
by liewjp
Yes, that works. Thanks for fast respond and Help !

:D

Posted: Mon Jan 25, 2010 4:41 pm
by Softanics
You are welcome! :)