• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1190
  • Last Modified:

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
0
andru
Asked:
andru
  • 3
  • 2
  • 2
  • +2
2 Solutions
 
mikelittlewoodCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kretzschmarCommented:
??

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now