Board index » delphi » JPEG Error loading a JPEG Image from BlobBinary field

JPEG Error loading a JPEG Image from BlobBinary field

I 'm loading a JPEG image saved to a binary field with this procedure:

Procedure CarregaJpeg( var BitMap : TBitMap; var Campo : TBlobField );
var
   JPEGImagem : TJPEGImage;
   bbstDesenho :TBlobStream;
begin
  bbstDesenho := TBlobStream.Create( Campo, bmRead);
  try
   JPEGImagem := TJpegImage.Create;
   try
     JPEGImagem.LoadFromStream( bbstDesenho );
     Bitmap.Assign( JPEGImagem );
   finally
     JPEGImagem.Free;
   end;
  finally
    bbstDesenho.Free;
  end;
end;

If the application is running under Delphi 3, I recive this error message:

   JPEG error #52         line - JPEGImagem.LoadFromStream( bbstDesenho );

How the meaning of this message

Thanks.

Nelson Cipriano Junior.
S?o Paulo - Brazil.

 

Re:JPEG Error loading a JPEG Image from BlobBinary field


I cannot say for sure, but I did something very similar recently and found
that needed to point to the begining of the stream before saving to file or
assigning to bitmap. The solution to my problem was solved with
mystream.seek(0,0) and then save to file.... hope this helps you.
                                                        Dave

Nelson Cipriano Jr. <cipri...@imagenet.com.br> wrote in article
<6ab14b$n...@forums.borland.com>...

Quote
> I 'm loading a JPEG image saved to a binary field with this procedure:

> Procedure CarregaJpeg( var BitMap : TBitMap; var Campo : TBlobField );
> var
>    JPEGImagem : TJPEGImage;
>    bbstDesenho :TBlobStream;
> begin
>   bbstDesenho := TBlobStream.Create( Campo, bmRead);
>   try
>    JPEGImagem := TJpegImage.Create;
>    try
>      JPEGImagem.LoadFromStream( bbstDesenho );
>      Bitmap.Assign( JPEGImagem );
>    finally
>      JPEGImagem.Free;
>    end;
>   finally
>     bbstDesenho.Free;
>   end;
> end;

> If the application is running under Delphi 3, I recive this error
message:

>    JPEG error #52         line - JPEGImagem.LoadFromStream( bbstDesenho
);

> How the meaning of this message

> Thanks.

> Nelson Cipriano Junior.
> S?o Paulo - Brazil.

Re:JPEG Error loading a JPEG Image from BlobBinary field


I get JPEG Error #52 if the blobfield is empty.
--
Tim Borman
tbor...@nospam.prophase.com
please reply to this newsgroup
-----------------------------------------------------

Quote
Nelson Cipriano Jr. wrote in message <6ab14b$n...@forums.borland.com>...
>I 'm loading a JPEG image saved to a binary field with this procedure:

>Procedure CarregaJpeg( var BitMap : TBitMap; var Campo : TBlobField );
>var
>   JPEGImagem : TJPEGImage;
>   bbstDesenho :TBlobStream;
>begin
>  bbstDesenho := TBlobStream.Create( Campo, bmRead);
>  try
>   JPEGImagem := TJpegImage.Create;
>   try
>     JPEGImagem.LoadFromStream( bbstDesenho );
>     Bitmap.Assign( JPEGImagem );
>   finally
>     JPEGImagem.Free;
>   end;
>  finally
>    bbstDesenho.Free;
>  end;
>end;

>If the application is running under Delphi 3, I recive this error message:

>   JPEG error #52         line - JPEGImagem.LoadFromStream( bbstDesenho );

>How the meaning of this message

>Thanks.

>Nelson Cipriano Junior.
>S?o Paulo - Brazil.

Other Threads