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, December 13, 2010 12:17:18 PM(UTC)

sasha  
sasha

Groups: Registered
Posts: 4


Using your MainDemo application I found optimal combination of the algorithm and Quality Factor (file type- .tif, subtype CMP, QF125) to compress the 8 bit TIFF file. Now I am trying to accomplish the same result using your .Net APIs. Could you point me to a C# sample code? MainDemo is implemented using C++, where functionality seems to be hidden within libraries (or I could not find it).

In the C# samples I've seen there are no parameters specifying Quality Factor :-(

Thanks 

 

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 : Monday, December 13, 2010 10:58:17 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

When saving TIFF with CMP compression, you can specify the Quality Factor by using the codecs.Options.Jpeg.Save.QualityFactor property as follows:
+---------+
RasterImage currentImage = codecs.Load(@"C:\IMAGE1.CMP");

codecs.Options.Jpeg.Save.QualityFactor = 125;

codecs.Save(currentImage, @"C:\IMAGE1_255.tif", RasterImageFormat.TifCmp, 8);
+---------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Tuesday, December 14, 2010 6:22:00 AM(UTC)

sasha  
sasha

Groups: Registered
Posts: 4


Thanks a lot, Maen,

I am a little confused about your sample, which shows you that I need to better understand the basics. The file that I am trying to compress is .tif file. I thought I would be loading the tif file and saving the .cmp...

So, here is the code I am testing now and getting an exception when calling Save.

RasterImage image = codecs.Load(singlePageFileName);
codecs.Options.Jpeg.Save.QualityFactor = 125;
codecs.Save(image, fileCompressed, RasterImageFormat.Cmp, 8);


The exception has a message: "Feature not supported" with the following call stack:

at Leadtools.RasterException.CheckErrorCode(Int32 code)
   at Leadtools.Codecs.RasterCodecs.SaveOnePage(Int32 page, SaveParams saveParams)
   at Leadtools.Codecs.RasterCodecs.DoSave(SaveParams saveParams)
   at Leadtools.Codecs.RasterCodecs.Save(RasterImage image, String fileName, RasterImageFormat format, Int32 bitsPerPixel)

 What am doing wrong? Thanks.

 

 
#4 Posted : Tuesday, December 14, 2010 7:42:12 AM(UTC)

sasha  
sasha

Groups: Registered
Posts: 4


Needed reference to Leadtools.Codecs.Cmp.dll

I think the message could me more descriptive...

 
#5 Posted : Wednesday, December 15, 2010 12:56:16 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

In your original post, you mentioned that you want to save TIFF files with subtype CMP. This is why I used RasterImageFormat.TifCmp in the sample code.
If you want to save TIFF files with CMP compression, you need to use RasterImageFormat.TifCmp. But if you want to save pure CMP images, you can use the RasterImageFormat.Cmp.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#6 Posted : Thursday, December 16, 2010 7:14:01 AM(UTC)

sasha  
sasha

Groups: Registered
Posts: 4


Thanks. You are right. That comes from general confusion about these formats.

Could you explain the differense and/or benefits of using .tiff with CMP compression vs. pure CMP images?

Alex

 

 
#7 Posted : Friday, December 17, 2010 12:25:36 PM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

Hello Alex,

The only difference between TIFF with CMP and CMP files along are that you can group multiple CMP compressed image together in TIFF files, as the TIFF file format is a multi-page format, whereas CMP is only a single page format. TIFF files also have tags that you can use to include additional information about the file.

If you were annotating images as well, using a TIFF would be better than CMP because you can save the annotations into the tags with the TIFF file.
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-2024, Yet Another Forum.NET
This page was generated in 0.082 seconds.