Solved

BlobStream convert to JPEG using ImageLib

Posted on 2009-05-05
8
782 Views
Last Modified: 2012-05-06
I have images stored in a table, they may or may not be Bitmap, we do not have the extension stored in the table.
I need to convert every image in the table to JPEG using the ImageLib suite.

Anyone have any code showing how to do this?
0
Comment
Question by:EddieShipman
  • 4
  • 4
8 Comments
 
LVL 14

Expert Comment

by:SteveBay
ID: 24311071
Hmm. There is a strikingly similar Q posted in the imagelib_corperate_suite NG;) Don't hold your breath waiting for an answer over there.

I know it's not meant to work on streams.. but you could try saving the blob to a file and then use TPMultiImage.GetInfoAndType function. Then check the value of TPMultiImage.BFileType. I've never tried it but the help file description suggests that it might be what you are looking for
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24314227
I really didn't want to save it to a file, first. Can I not load the TPMultiImage from a stream and then use the GetInfoAndType function to determine the graphic class I need to create?
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24314233
Yes, it is the same, it was posted with my boss' account.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 14

Expert Comment

by:SteveBay
ID: 24314300
I have some ideas but no time to test them right now. Stay tuned.
0
 
LVL 14

Accepted Solution

by:
SteveBay earned 500 total points
ID: 24314391
This is something I tried late last night and it seems to be able to tell the difference between Bimaps and JPEG. I got results like this:

FImageType JPEG, Fwidth 270, FHeight 180, Fbitspixel 24,  Fnumcolors 0, Fcompression RGB
FImageType BMP, Fwidth 270, FHeight 180, Fbitspixel 24,  Fnumcolors 0, Fcompression None




Uses DLL96V1
//....
procedure TForm1.Button1Click(Sender: TObject);
var ms : TMemoryStream;
     FImageType : String;
     Fwidth        : SmallInt;
     FHeight       : SmallInt;
     Fbitspixel    : SmallInt;
     Fplanes       : SmallInt;
     Fnumcolors    : SmallInt;
     Fcompression : String;
begin
     Memo1.Clear;
     Table1.Active := True;
     Table1.First;
 
     ms := TMemoryStream.Create;
 
     while not Table1.Eof do
          begin
          ms.Clear;
          TBlobField(Table1.FieldByName('Data')).SaveToStream(ms);
          ms.Position := 0;
          GetBlobInfo(ms.Memory,
                      ms.Size,
                      FImageType,
                      Fwidth,
                      FHeight,
                      Fbitspixel,
                      Fplanes,
                      Fnumcolors,
                      Fcompression );
          Memo1.Lines.Add(Format('FImageType %s, Fwidth %d, FHeight %d, Fbitspixel %d,  Fnumcolors %d, Fcompression %s',
                              [ FImageType , Fwidth , FHeight , Fbitspixel ,  Fnumcolors , Fcompression]));
 
 
          Table1.Next;
          end;
     ms.Free;
end;

Open in new window

0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24317427
ok, I will give it a try and see if it is what I need.
DLL96V1 is an ImageLib unit, correct?
0
 
LVL 14

Expert Comment

by:SteveBay
ID: 24317828
It sure is.
I find it in C:\Program Files\SkyLine\ImageLib7\Vcl_Del7 on my system.
0
 
LVL 26

Author Closing Comment

by:EddieShipman
ID: 31578231
Looks great and it works, Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Syntax Check Delphi Seattle IOS app without MAC ? 1 104
Delphi Yen format 3 45
can i put an image from resource into image tag ? 6 26
Firemonkey BASS_Init into a thread 17 30
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question