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



Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, March 31, 2015 9:31:31 PM(UTC)


Groups: Registered
Posts: 7


I'm trying to activate Huffman algorithm on my images.

According to this document (https://www.leadtools.com/help/leadtools/v19/dicom/clib/ldicomds__setimagelist.html), i'm setting the Options.Jpeg.Save.Passes to 2.

The file size is effectively lower than without setting the option.
But the image seems to be corrupted, blur while i'm openning it with photoshop.

I joined the input image, the output without the option passes and with the option passes at 2.

Here si my code :

RasterCodecs _rasterCodecs = new RasterCodecs();
RasterImage _rasterImage = _rasterCodecs.Load(_input );
SizeCommand command = new SizeCommand();
command.Height = 445;
command.Width = 670;
command.Flags = RasterSizeFlags.Bicubic;
_rasterCodecs.Options.Jpeg.Save.QualityFactor = 39;
_rasterCodecs.Options.Jpeg.Save.Passes = 2;

_rasterCodecs.Save(_rasterImage, filepath, RasterImageFormat.Jpeg, 24);

By the way, is there a way to just apply Huffman algorithme without doing jpg lossy comppression (like jpegtran.exe) ?

Thanks for your help.

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, March 31, 2015 9:32:41 PM(UTC)


Groups: Registered
Posts: 7

Attachments here.
File Attachment(s):
TestHuffman.zip (2,843kb) downloaded 43 time(s).
#3 Posted : Thursday, April 2, 2015 5:56:48 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

The following online help topic contains more accurate information about saving your images with optimized Huffman tables:

According to the documentation, you need to set the Codecs.Options.Jpeg.Save.Passes property to 1 to use Huffman tables.
I tested this on my side using the latest LEADTOOLS v19 .Dotnet4 DLLs and got a smaller size for the output file (I am attaching the result image that I got on my side).

Please try to set the Passes property to 1, and let me know if you face any problem.

Maen Badwan
LEADTOOLS Technical Support
Maen Hasan attached the following image(s):
#4 Posted : Monday, April 6, 2015 11:27:47 PM(UTC)


Groups: Registered
Posts: 7

Thanks for your help, it's working !

Edited by moderator Thursday, March 23, 2017 3:40:34 PM(UTC)  | Reason: Not specified

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.123 seconds.