#1
Posted
:
Monday, May 8, 2017 11:10:27 PM(UTC)
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.
#2
Posted
:
Tuesday, May 9, 2017 8:35:10 AM(UTC)
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.htmlHere is the Compression Quality Factors page:
https://www.leadtools.co...ssionqualityfactors.htmlIn 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.htmlQuote: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.
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.