TJPEGImageAssign (C++)
Description
This example converts a bitmap image to a jpeg file by using the Assign method. This example requires a button and two images. One image must have its Picture property loaded with a bitmap at design time.
Code
#include <Jpeg.hpp>
#include <memory> //For STL auto_ptr class
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//Requires "jpeg.hpp" to be included in the source file.
std::auto_ptr<TJPEGImage> jp(new TJPEGImage());
jp->Assign(Image1->Picture->Bitmap);
jp->SaveToFile("..\\factory.jpg");
Image2->Stretch = True;
Image2->Picture->LoadFromFile("..\\factory.jpg");
}
Uses
- Vcl.Imaging.jpeg.TJPEGImage.Create ( fr | de | ja )
- Vcl.Imaging.jpeg.TJPEGImage.Assign ( fr | de | ja )
- Vcl.Graphics.TGraphic.SaveToFile ( fr | de | ja )
- Vcl.ExtCtrls.TImage.Stretch ( fr | de | ja )