Solved

BlobStream convert to JPEG using ImageLib

Posted on 2009-05-05
8
765 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

23 Experts available now in Live!

Get 1:1 Help Now