ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Shrink Physical Image Size
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

EnvisionIT

USA
3 Posts

Posted - Sep 23 2015 :  22:18:47  Show Profile  Reply
Have an issue, we use ImageEn to display images / capture images from camera's etc. They are stored in a DB. We have several clients that over time have image db's in the hundreds of GB.

I'd like to write a utility that shrinks the overall size of the image to 800 x 600 and convert the image to a jpg to minimize the physical size of the image.

I've got an TImageEnDBView component on a form. To convert the image to JPG's I've been using the SaveToFile('test.jpg', toJPEG).

Is there an easier way to shrink the image and convert to jpg's?

xequte

39056 Posts

Posted - Sep 24 2015 :  05:32:30  Show Profile  Reply
Hi

Are you using v6.2.0? It has a new TIEDBBitmap, which makes the process much easier.

MyBMP := TIEDBBitmap.Create();
MyBMP.Read( MyTableImageBlobField );
MyBmp.Resample( 800, 600, rfLanczos3, true);
MyBmp.JpegQuality := 75;
MyBmp.Write( MyTableImageBlobField, ioJPEG );
MyBmp.Free;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

EnvisionIT

USA
3 Posts

Posted - Sep 25 2015 :  23:18:41  Show Profile  Reply
Thanks Nigel,

I am using 6.2.

However, this code will not compile...

uses iexDBBitmaps;

MyBMP := TIEDBBitmap.Create;
try
MyBMP.Read(MEMIMG_IMAGE_BLOB);
MyBMP.Resize( 800, 600, rfLanczos3, True);
MyBMP.JpegQuality := 75;
MyBMP.Write(MEMIMG_IMAGE_BLOB, ioJPEG);
finally
MyBMP.Free;
end;

Hovering over the above Resize and I get the following:

TIEBitmap.Resize(Integer, Integer, Double, Integer, TIEHAlign, TIEVAlign)

and upon compiling:

[dcc32 Error] MainU.pas(74): E2010 Incompatible types: 'Double' and 'TResampleFilter'
Go to Top of Page

xequte

39056 Posts

Posted - Sep 27 2015 :  20:54:39  Show Profile  Reply
Sorry, that method should be Resample, not Resize. I have updated the example.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: