Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Draw onto bitmap produces jpeg exception 41



Permlink Replies: 1 - Last Post: Dec 28, 2017 4:21 AM Last Post By: Alex Belo Threads: [ Previous | Next ]
Keith Dopson

Posts: 63
Registered: 3/16/00
Draw onto bitmap produces jpeg exception 41
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 27, 2017 3:51 PM
void __fastcall TForm1::ImageGrayScale(TImage * AnImage)
{
TJPEGImage *JPGImage;
Graphics::TBitmap * BMPImage;
BMPImage = new Graphics::TBitmap;

try
{
BMPImage->Width=AnImage->Picture->Bitmap->Width;
BMPImage->Height=AnImage->Picture->Bitmap->Height;

JPGImage=new TJPEGImage;

try
{
JPGImage->LoadFromFile(OpenDialog1->FileName);
JPGImage->CompressionQuality = 100;
JPGImage->Compress();
JPGImage->Grayscale=true;

BMPImage->Canvas->Draw(0, 0, JPGImage);
:
:

The ->Draw throws EJPEG with message "JPEG error #41"

AnImage is a TImage dropped onto the unit's form.

Builder 5 C++ Ent.

What is #41 for EJPEG?

Where might I locate documentation re: EJPEG #41?

Alex Belo

Posts: 625
Registered: 10/8/06
Re: Draw onto bitmap produces jpeg exception 41
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 28, 2017 4:21 AM   in response to: Keith Dopson in response to: Keith Dopson
Keith Dopson wrote:

BMPImage->Canvas->Draw(0, 0, JPGImage);

The ->Draw throws EJPEG with message "JPEG error #41"

Use

BMPImage->Assign(JPGImage);

instead.

--
Alex
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02