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
 ImageEnVect Adjust Bitmap Issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

andyhill

Australia
159 Posts

Posted - May 02 2016 :  20:11:27  Show Profile  Reply
I want to load an image, change it's color depth, resize it and save.

All attempts yield larger files than any other image processing software that I have used using the same source image and image parameters.

eg.
Corel yields 13k file
ImageEn yields 40k file

All with the same settings ?

Please advise - thanks


      Thumb.ClearAll;
      // Set DPI
      Thumb.IO.Params.DpiX:= 96;
      Thumb.IO.Params.DpiY:= 96;
      // Set to 256 colors
      Thumb.IO.Params.BitsPerSample:= 8;
      Thumb.IO.Params.SamplesPerPixel:= 1;
      //
      Thumb.IO.LoadFromFile(OpenPictureDialog1.FileName);
      Thumb.RemoveAlphaChannel;
      // Set again just in case it was blown away by load
      // Set DPI
      Thumb.IO.Params.DpiX:= 96;
      Thumb.IO.Params.DpiY:= 96;
      // Set 256 colors
      Thumb.IO.Params.BitsPerSample:= 8;
      Thumb.IO.Params.SamplesPerPixel:= 1;
      // Set Size
      Thumb.Proc.Resample(100, 100, rfFastLinear, True);
      Thumb.Update;
      //
      Thumb.IO.Params.JPEG_Quality:= 80;
      Thumb.IO.SaveToFileJpeg(fMain.UserAppDataPath+'Work\Thumbnail.jpg');


Andy

xequte

39061 Posts

Posted - May 03 2016 :  01:01:41  Show Profile  Reply
Hi Andy

Also strip the meta data before saving:

Thumb.IO.Params.ResetInfo;

{
// None of this code before loading is needed

      Thumb.ClearAll;
      // Set DPI
      Thumb.IO.Params.DpiX:= 96;
      Thumb.IO.Params.DpiY:= 96;
      // Set to 256 colors
      Thumb.IO.Params.BitsPerSample:= 8;
      Thumb.IO.Params.SamplesPerPixel:= 1;
      //
}
      Thumb.IO.LoadFromFile(OpenPictureDialog1.FileName);

// Not needed for JPEGs
{
      Thumb.RemoveAlphaChannel;
}

      // Set DPI
// This won't affect the size of the image
      Thumb.IO.Params.DpiX:= 96;
      Thumb.IO.Params.DpiY:= 96;

// Not needed for JPEGs
{
      // Set 256 colors
      Thumb.IO.Params.BitsPerSample:= 8;
      Thumb.IO.Params.SamplesPerPixel:= 1;
}

      // Set Size
      Thumb.Proc.Resample(100, 100, rfFastLinear, True);

// Not needed
{
      Thumb.Update;
}

// Remove the meta-data
      Thumb.IO.Params.ResetInfo;

      Thumb.IO.Params.JPEG_Quality:= 80;
      Thumb.IO.SaveToFileJpeg(fMain.UserAppDataPath+'Work\Thumbnail.jpg');



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

andyhill

Australia
159 Posts

Posted - May 03 2016 :  16:25:48  Show Profile  Reply
That did it - thanks

Andy
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: