Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, August 21, 2017 7:00:01 AM(UTC)

Cory  
Cory

Groups: Registered
Posts: 1


Hello,

Is there any way to shrink/compress the physical size of an image (ex. from 8MB) to another given size (ex. to 4MB) without changing the resolution?

I tried using ChangeCompression but that changes the size only twice, after that the size is not affected anymore.

I would need a method that also accepts as parameter the size I need to get to OR a loop where I call a method that shrinks the size until it reaches the required one.

I am using Version 19.

Thank you!
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, August 22, 2017 8:46:06 AM(UTC)

Walter  
Walter

Groups: Tech Support, Administrators
Posts: 310

Was thanked: 3 time(s) in 3 post(s)

Hello,

We had a live chat session to discuss this, so I will post a short summary here.

The ChangeCompression() method only affects the image data while it's in memory. In memory, the image can be uncompressed, run-length encoded, or use a LEAD proprietary compression. When the image is written to disk though, the image data in memory would have to be uncompressed first (if it isn't already) and then re-compressed before (or as) being written to disk. So the ChangeCompression() method I don't think is going to help you based on your question here.

There are two things that affect image compression:
1.) Physical size (height/width) of the image
2.) Compression used

Since changing the physical size is out, that leaves you with just changing the compression. You could technically change the bit depth of an image to reduce the output file size. This could work in cases where the original image is say 32-bit and you write out a 24-bit file. If that doesn't change the image quality and it's not data that you need, it could be a significant savings writing 25% less data for each pixel.

Some compressions do provide options that let you control the amount of compression being applied. For example, JPEG and PNG both have quality factor properties with their save options you can try. Check out CodecsJpegSaveOptions.QualityFactor and CodecsPngSaveOption.QualityFactor.

Pro-tip: The amount of compression you use is inversely proportional to the image quality. Generally the more you compress the image, the lower the image quality will be. The measure of an image compression is how much quality is retained versus the amount of compression it can apply.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.150 seconds.