Why lousy JPG support with Delphi

Hi Ppl

Why is JPG support so lousy with Delphi? Are there any work arounds?

I've put Jpeg in the uses clause as I have done before I was reminded on another thread of the same subject. But, the only thing is JPGs take ages to load, and when my software tries to modify a image I get the error 'Can only modify an image if it contains a bitmap'.

How can I convert a jpeg image to DIB format so that I can modify the image?

TIA
andruAsked:
Who is Participating?
 
mikelittlewoodConnect With a Mentor Commented:
There is a property of a TJpegImage which I think can change the image for you to a bitmap representation

jpg.DIBNeeded
0
 
mikelittlewoodCommented:
Quote from Delphi help

<DIBNeeded is used when the jpeg image needs a bitmap representation of its image. Call DIBNeeded just before drawing rather than while drawing for optimization.>
0
 
BlackTigerXCommented:
how do you "try to modify the image"?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
kretzschmarConnect With a Mentor Commented:
??

simple create an aditional bmp-object, transfer thze jpg there,
make your paintings and transfer back, like

var
  jpg : TJpegImage;
  bmp : TBitmap;
begin
  jpg := TJpegImage.Create;
  bmp : TBitmap.Create;
  try
    jpg.LoadFromFile('PathFileNameHere');
    bmp.assign(jpg);

    //painting on bitmap here

    jpg.assign(bmp)
    jpg.SaveToFile('PathFileNameHere');
  finally
    jpg.free;
    bmp.free;
  end;
end;

meikl ;-)
0
 
rwmoreyCommented:
Hi --

I use a great component called TImageEn .. You can find it here

http://www.hicomponents.com/nimageen.asp

Rich
0
 
kretzschmarCommented:
?? well, rwmorey , will be a nice TImage-replacement, but solves not the entire question

meikl ;-)
0
 
rwmoreyCommented:
Hi..

Sorry.. You are right I did not answer the complete question. There is the ability to load and save various file formats, including converting from one format to another (GIF, TIFF, JPEG, BMP, WMF) and I am pretty sure you can manipulate the images in any of the formats through the various included components.

Rich
0
 
andruAuthor Commented:
procedure tblink_form.load_image(
  name:string);
var
  picture:tpicture;
begin
  picture:=tpicture.create;
  picture.LoadFromFile(name);
end;

When a Jpeg has been loaded with the above code, how do I make it so that I can modify the image in picture?

TIA
0
 
kretzschmarCommented:
>When a Jpeg has been loaded with the above code, how do I make it so that I can
>modify the image in picture?

transform it into a bitmap,
manipulate it,
transform back to jpeg

see my small sample above

meikl ;-)
0
 
andruAuthor Commented:
How do I know if the image is a jpeg as it is coming via the load image dialog.

TIA
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.