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 : Wednesday, September 23, 2009 12:17:23 PM(UTC)
linhardt

Groups: Registered
Posts: 3


I have a .tifabc file (C:\test.tifabc) and I want to get that file and convert it to a .tif without having to open the image into a rasterimageviewer screen.

I know that


<span style="color=blue;">
<font face="Lucida Console" size="2">
codecs.Save(_ipr._viewer.Image, strm, RasterImageFormat.Tif, 1, 1, _ipr._viewer.Image.PageCount, 1, CodecsSavePageMode.Overwrite);
</font>
</span>


will save the image from the viewer to a memorystream, but I would like to know how to do it without even pulling it up in the viewer. I just need to grab the file, save as tif in a memorystream.

Any assistance would be appreciated.
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 : Thursday, September 24, 2009 12:09:43 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

What is the format of your .tifabc file? Is it a TIFF file with LEAD ABC compression?
Also, what is the format you wish to convert it to? I know it's TIFF, but you didn't specify a TIFF sub-type.
Your code appears to be saving as 1-bit uncompressed TIFF. Is this the format you need?

If you want to convert any supported format to uncompressed TIFF, you can use RasterCodecs.Load and RasterCodecs.Save without the need to display anything.
Instead of using RasterImageViewer.Image to hold the bitmap that gets loaded and saved, you could simply declare a temporary object of type RasterImage like this:
Leadtools.RasterImage temp_image = codecs.Load(@"C:\test.tifabc");
codecs.Save(temp_image, strm, ...);

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Thursday, September 24, 2009 6:23:52 AM(UTC)
linhardt

Groups: Registered
Posts: 3


Ok. I am closer than before. I get the tif. But when you try to view it, it is just blank.

Here is some of the code. Not sure if I got it all right.


public RasterImage LoadImageGIRTemp(int GIRIMGDocumentHeaderID)
{
GIRIMGDocumentHeader gdh = new GIRIMGDocumentHeader();
gdh.LoadByPrimaryKey(GIRIMGDocumentHeaderID);
RasterCodecs io = new RasterCodecs();
RasterSupport.Unlock(Leadtools.RasterSupportType.Abc, "?????");
RasterSupport.Unlock(Leadtools.RasterSupportType.Document, "??????");
RasterImage temp_image = io.Load(@"C:\test.tifabc")
return temp_image;
}

RasterImage temp_image = LoadImageGIRTemp(Convert.ToInt32(dr[GIRIMGDocumentHeaderSchema.ID.FieldName].ToString()));

MemoryStream strm = new MemoryStream();
RasterCodecs codecs = new RasterCodecs();
codecs.Save(temp_image, strm, RasterImageFormat.Tif, 1, 1, temp_image.PageCount, 1, CodecsSavePageMode.Overwrite);
 
#4 Posted : Thursday, September 24, 2009 11:28:44 AM(UTC)
linhardt

Groups: Registered
Posts: 3


I found the problem. It is working, but after the codecs.save(), I had to set the strm back to the beginning with strm.Position = 0; so the stream then could be used in my email code.

Thanks.
 
#5 Posted : Thursday, September 24, 2009 12:27:17 PM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

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

Hello,

In the future please be careful not to post your unlock codes on the forums.  These forums are public so anyone can view them.  Thank you for your cooperation.

LEADTOOLS Support
 
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.089 seconds.