por yalmar » Mié Sep 27, 2006 9:57 pm
No entendi bien,
Lo que deseas es convertir de jpg a bmp? y luego de bmp a jpg?
si es el caso, el siguiente código hace estas conversiones.
//---------------------------------------------------------------------------
#include <vcl.h>
#include <vcl/jpeg.hpp>
#pragma hdrstop
#include "Unit1.h"
.
.
.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
jpg = new TJPEGImage();
if (OpenPictureDialog1->Execute()){
jpg->LoadFromFile(OpenPictureDialog1->FileName);
Image1->Canvas->Draw(0,0,jpg);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
bmp = new Graphics::TBitmap();
bmp->PixelFormat = pf24bit;
bmp->Height = jpg->Height;
bmp->Width = jpg->Width;
bmp->Canvas->Draw(0,0, jpg);
Image2->Canvas->Draw(0, 0, bmp);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
try{
jpg2 = new TJPEGImage();
jpg2->CompressionQuality = 80;
jpg2->Assign(bmp);
}__finally {
Image3->Canvas->Draw(0,0,jpg);
}
}
//---------------------------------------------------------------------------
salu2