Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read tiff file

Status
Not open for further replies.
Jun 7, 2013
1
ID
hello,
how to read tiff file with power builder 11.5
only for preview...

Thanks alot
 
If you just need to display the file in the default application assigned to it you can use the run command with the file name. Windows will then launch the viewing app which then displays the file.

Matt

"Nature forges everything on the anvil of time"
 
HELLO
Here is the code to scan tiff files.you can have a look:
using System.IO;
using System.Drawing.Printing;
using RasterEdge.Imaging;
using RasterEdge.Imaging.Processing;
using RasterEdge.Imaging.MultipageTiff;

RasterEdgeImaging TIFF = new RasterEdgeImaging();
public class AcquisitionClass
{
private bool AcquireCanceled;
private Acquisition Acquisition = new Acquisition(this);
public void Scan()
{
AcquireCanceled = false;
Acquisition.AcquireCanceled += new EventHandler(OnAcquireCanceled);
Acquisition.AcquireFinished += new EventHandler(OnAcquireFinished);
Acquisition.ImageAcquired += new ImageAcquiredEventHandler(OnImageAcquired);
Device activeDevice = Acquisition.ShowSelectSource();
activeDevice.Acquire();
}
private void OnImageAcquired(object sender, AcquireEventArgs e)
{
if (e.Image != null)
{
TiffEncoder enc = new TiffEncoder(TiffCompression.Default, true);
FileStream fs = new FileStream("1.tif",FileMode.OpenOrCreate, FileAccess.ReadWrite);
enc.Save(fs, AtalaImage.FromBitmap(e.Image), null);
fs.Close();
}
}
private void OnAcquireCanceled(object sender, EventArgs e)
{
AcquireCanceled = true;
}
private void OnAcquireFinished(object sender, EventArgs e)
{
if (AcquireCanceled)
return;
TiffImageCollection col = new TiffImageCollection();
TiffDecoder dec = new TiffDecoder();
FileStream fs = new FileStream("1.tif", FileMode.Open, FileAccess.Read);
int frameCount = dec.GetFrameCount(fs);
fs.Close();
for(int i=0; i< frameCount; i++)
col.Add(new TiffImage("1.tif", i, TiffCompressionType.Auto));

FileStream outStream = new FileStream("1.tiff", FileMode.OpenOrCreate, FileAccess.ReadWrite);
TiffEncoder enc = new TiffEncoder();
enc.Save(outStream, col, null);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top