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, May 8, 2017 11:10:27 PM(UTC)
THenrich

Groups: Registered
Posts: 1


Which example shows jpg compression? I would like to know how to compress jpg (not jpeg2000) files and specifying ratio of compression and lossless or with loss.
 

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, May 9, 2017 8:35:10 AM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 218

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

Hello,

Thank you for posting your question on the LEADTOOLS Technical Support Forums.

Here is the JPEG File Format page:
https://www.leadtools.co...jpx-jp2-jls-cmp-cmw.html

Here is the Compression Quality Factors page:
https://www.leadtools.co...ssionqualityfactors.html

In order to compress an image as JPEG while specifying the ratio of compression, you will need to use the RasterCodecs class. The RasterCodecs class has a CodecsJpegSaveOption class that will let you specify a QualityFactor:
https://www.leadtools.co...tions-qualityfactor.html

Quote:
You can set a value from 2 to 255, where 2 is the highest quality and 255 is the most compression.
You can also use a factor of 0 to produce lossless JPEG files.
For information on formats that support quality factor, refer to Compression Quality Factors.


Here is come quick sample code to show how to access the Quality factor and save as a JPEG compress image:

Code:
using (RasterCodecs codecs = new RasterCodecs())
{
 codecs.Options.Jpeg.Save.QualityFactor = 100;
 codecs.Save(img, "test.jpg", RasterImageFormat.Jpeg, 0);
}

Edited by user Wednesday, February 17, 2021 9:05:53 AM(UTC)  | Reason: Not specified

Hadi Chami
Developer Support Manager
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-2024, Yet Another Forum.NET
This page was generated in 0.064 seconds.