Solved

BlobStream convert to JPEG using ImageLib

Posted on 2009-05-05
8
769 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
 
LVL 14

Expert Comment

by:SteveBay
ID: 24314300
I have some ideas but no time to test them right now. Stay tuned.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now