473,796 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

General GDI+ Error

I use a class to manage tiff's (written by someone else) to splitt multipage
tiffs. However, when I run it, it fails, for other people it seems work ok.

The method in the class is :public ArrayList SplitTiffImage( string
outPutDirectory ,EncoderValue format)
{
string
fileStartString =outPutDirector y+"\\"+GetFileN ameStartString( _ImageFileName) ;
ArrayList splitedFileName s=new ArrayList();
try
{
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

//Saves every frame as a separate file.
Encoder enc=Encoder.Com pression;
int curFrame=0;
for (int i=0;i<_PageNumb er;i++)
{
image.SelectAct iveFrame(objDim ension,curFrame );
EncoderParamete rs ep=new EncoderParamete rs(1);
ep.Param[0]=new EncoderParamete r(enc,(long)for mat);
ImageCodecInfo info=GetEncoder Info("image/tiff");

//Save the master bitmap
string fileName=string .Format("{0}{1} .TIF",fileStart String,i.ToStri ng());
image.Save(file Name,info,ep);
splitedFileName s.Add(fileName) ;

curFrame++;
}
}
catch (Exception)
{
throw;
}

return splitedFileName s;
}

My vb.net app (sorry c#-peeps :-O ) uses the code :
For Each str As String In CmdArgs
If str.ToLower = "/splittiff" Then
If CmdArgs.Length = 2 Then
Dim tiffmngr As New TiffManager(Cmd Args(1))
Console.Write(C mdArgs(1))
Dim Filenames As ArrayList
tiffmngr.TempWo rkingDir = "c:\output\temp "
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
Else
Console.WriteLi ne("TiffSplit <tif filename>")
End If
End If

I run the code and I receive the following error:

C:\Documents and Settings\pwg\My Documents\Visua l Studio Projects\GEK
Release 1\GEK Release 1\bin>gek /splittiff veel.ti
f
veel.tif
Unhandled Exception: System.Runtime. InteropServices .ExternalExcept ion: A
generic error occurred in GDI+.
at System.Drawing. Image.Save(Stri ng filename, ImageCodecInfo encoder,
EncoderParamete rs encoderParams)
at TiffManager.Spl itTiffImage(Str ing outPutDirectory , EncoderValue
format) in C:\Documents and Settings\pwg\My Docume
nts\Visual Studio Projects\TIFFMa nager\TIFFManag er\TIFFManager. cs:line 90
at GEK_Release_1.M odule1.Main(Str ing[] CmdArgs) in C:\Documents and
Settings\pwg\My Documents\Visua l Studio Projects\
GEK Release 1\GEK Release 1\Module1.vb:li ne 15

I have checked and double checked everything, and it should work.. but it
keeps on failing. Any ideas?

Nov 17 '05 #1
7 7325
Hi Philip,
try changing the following line from:
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)

to:

Filenames = tiffmngr.SplitT iffImage("c:\\o utput\\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)

or

Filenames = tiffmngr.SplitT iffImage(@"c:\o utput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
The \ is an escape character that is probably being improperly interpretted.

Hope that helps
Mark R Dawson
http://www.markdawson.org


"Philip Wagenaar" wrote:
I use a class to manage tiff's (written by someone else) to splitt multipage
tiffs. However, when I run it, it fails, for other people it seems work ok.

The method in the class is :public ArrayList SplitTiffImage( string
outPutDirectory ,EncoderValue format)
{
string
fileStartString =outPutDirector y+"\\"+GetFileN ameStartString( _ImageFileName) ;
ArrayList splitedFileName s=new ArrayList();
try
{
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

//Saves every frame as a separate file.
Encoder enc=Encoder.Com pression;
int curFrame=0;
for (int i=0;i<_PageNumb er;i++)
{
image.SelectAct iveFrame(objDim ension,curFrame );
EncoderParamete rs ep=new EncoderParamete rs(1);
ep.Param[0]=new EncoderParamete r(enc,(long)for mat);
ImageCodecInfo info=GetEncoder Info("image/tiff");

//Save the master bitmap
string fileName=string .Format("{0}{1} .TIF",fileStart String,i.ToStri ng());
image.Save(file Name,info,ep);
splitedFileName s.Add(fileName) ;

curFrame++;
}
}
catch (Exception)
{
throw;
}

return splitedFileName s;
}

My vb.net app (sorry c#-peeps :-O ) uses the code :
For Each str As String In CmdArgs
If str.ToLower = "/splittiff" Then
If CmdArgs.Length = 2 Then
Dim tiffmngr As New TiffManager(Cmd Args(1))
Console.Write(C mdArgs(1))
Dim Filenames As ArrayList
tiffmngr.TempWo rkingDir = "c:\output\temp "
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
Else
Console.WriteLi ne("TiffSplit <tif filename>")
End If
End If

I run the code and I receive the following error:

C:\Documents and Settings\pwg\My Documents\Visua l Studio Projects\GEK
Release 1\GEK Release 1\bin>gek /splittiff veel.ti
f
veel.tif
Unhandled Exception: System.Runtime. InteropServices .ExternalExcept ion: A
generic error occurred in GDI+.
at System.Drawing. Image.Save(Stri ng filename, ImageCodecInfo encoder,
EncoderParamete rs encoderParams)
at TiffManager.Spl itTiffImage(Str ing outPutDirectory , EncoderValue
format) in C:\Documents and Settings\pwg\My Docume
nts\Visual Studio Projects\TIFFMa nager\TIFFManag er\TIFFManager. cs:line 90
at GEK_Release_1.M odule1.Main(Str ing[] CmdArgs) in C:\Documents and
Settings\pwg\My Documents\Visua l Studio Projects\
GEK Release 1\GEK Release 1\Module1.vb:li ne 15

I have checked and double checked everything, and it should work.. but it
keeps on failing. Any ideas?

Nov 17 '05 #2
That piece of code is vb.net and vb.net does not use escape characters

"Mark R. Dawson" wrote:
Hi Philip,
try changing the following line from:
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)

to:

Filenames = tiffmngr.SplitT iffImage("c:\\o utput\\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)

or

Filenames = tiffmngr.SplitT iffImage(@"c:\o utput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
The \ is an escape character that is probably being improperly interpretted.

Hope that helps
Mark R Dawson
http://www.markdawson.org


"Philip Wagenaar" wrote:
I use a class to manage tiff's (written by someone else) to splitt multipage
tiffs. However, when I run it, it fails, for other people it seems work ok.

The method in the class is :public ArrayList SplitTiffImage( string
outPutDirectory ,EncoderValue format)
{
string
fileStartString =outPutDirector y+"\\"+GetFileN ameStartString( _ImageFileName) ;
ArrayList splitedFileName s=new ArrayList();
try
{
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

//Saves every frame as a separate file.
Encoder enc=Encoder.Com pression;
int curFrame=0;
for (int i=0;i<_PageNumb er;i++)
{
image.SelectAct iveFrame(objDim ension,curFrame );
EncoderParamete rs ep=new EncoderParamete rs(1);
ep.Param[0]=new EncoderParamete r(enc,(long)for mat);
ImageCodecInfo info=GetEncoder Info("image/tiff");

//Save the master bitmap
string fileName=string .Format("{0}{1} .TIF",fileStart String,i.ToStri ng());
image.Save(file Name,info,ep);
splitedFileName s.Add(fileName) ;

curFrame++;
}
}
catch (Exception)
{
throw;
}

return splitedFileName s;
}

My vb.net app (sorry c#-peeps :-O ) uses the code :
For Each str As String In CmdArgs
If str.ToLower = "/splittiff" Then
If CmdArgs.Length = 2 Then
Dim tiffmngr As New TiffManager(Cmd Args(1))
Console.Write(C mdArgs(1))
Dim Filenames As ArrayList
tiffmngr.TempWo rkingDir = "c:\output\temp "
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
Else
Console.WriteLi ne("TiffSplit <tif filename>")
End If
End If

I run the code and I receive the following error:

C:\Documents and Settings\pwg\My Documents\Visua l Studio Projects\GEK
Release 1\GEK Release 1\bin>gek /splittiff veel.ti
f
veel.tif
Unhandled Exception: System.Runtime. InteropServices .ExternalExcept ion: A
generic error occurred in GDI+.
at System.Drawing. Image.Save(Stri ng filename, ImageCodecInfo encoder,
EncoderParamete rs encoderParams)
at TiffManager.Spl itTiffImage(Str ing outPutDirectory , EncoderValue
format) in C:\Documents and Settings\pwg\My Docume
nts\Visual Studio Projects\TIFFMa nager\TIFFManag er\TIFFManager. cs:line 90
at GEK_Release_1.M odule1.Main(Str ing[] CmdArgs) in C:\Documents and
Settings\pwg\My Documents\Visua l Studio Projects\
GEK Release 1\GEK Release 1\Module1.vb:li ne 15

I have checked and double checked everything, and it should work.. but it
keeps on failing. Any ideas?

Nov 17 '05 #3
That piece of code is vb.net and vb.net does not use escape characters

"Mark R. Dawson" wrote:
Hi Philip,
try changing the following line from:
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)

to:

Filenames = tiffmngr.SplitT iffImage("c:\\o utput\\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)

or

Filenames = tiffmngr.SplitT iffImage(@"c:\o utput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
The \ is an escape character that is probably being improperly interpretted.

Hope that helps
Mark R Dawson
http://www.markdawson.org


"Philip Wagenaar" wrote:
I use a class to manage tiff's (written by someone else) to splitt multipage
tiffs. However, when I run it, it fails, for other people it seems work ok.

The method in the class is :public ArrayList SplitTiffImage( string
outPutDirectory ,EncoderValue format)
{
string
fileStartString =outPutDirector y+"\\"+GetFileN ameStartString( _ImageFileName) ;
ArrayList splitedFileName s=new ArrayList();
try
{
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

//Saves every frame as a separate file.
Encoder enc=Encoder.Com pression;
int curFrame=0;
for (int i=0;i<_PageNumb er;i++)
{
image.SelectAct iveFrame(objDim ension,curFrame );
EncoderParamete rs ep=new EncoderParamete rs(1);
ep.Param[0]=new EncoderParamete r(enc,(long)for mat);
ImageCodecInfo info=GetEncoder Info("image/tiff");

//Save the master bitmap
string fileName=string .Format("{0}{1} .TIF",fileStart String,i.ToStri ng());
image.Save(file Name,info,ep);
splitedFileName s.Add(fileName) ;

curFrame++;
}
}
catch (Exception)
{
throw;
}

return splitedFileName s;
}

My vb.net app (sorry c#-peeps :-O ) uses the code :
For Each str As String In CmdArgs
If str.ToLower = "/splittiff" Then
If CmdArgs.Length = 2 Then
Dim tiffmngr As New TiffManager(Cmd Args(1))
Console.Write(C mdArgs(1))
Dim Filenames As ArrayList
tiffmngr.TempWo rkingDir = "c:\output\temp "
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
Else
Console.WriteLi ne("TiffSplit <tif filename>")
End If
End If

I run the code and I receive the following error:

C:\Documents and Settings\pwg\My Documents\Visua l Studio Projects\GEK
Release 1\GEK Release 1\bin>gek /splittiff veel.ti
f
veel.tif
Unhandled Exception: System.Runtime. InteropServices .ExternalExcept ion: A
generic error occurred in GDI+.
at System.Drawing. Image.Save(Stri ng filename, ImageCodecInfo encoder,
EncoderParamete rs encoderParams)
at TiffManager.Spl itTiffImage(Str ing outPutDirectory , EncoderValue
format) in C:\Documents and Settings\pwg\My Docume
nts\Visual Studio Projects\TIFFMa nager\TIFFManag er\TIFFManager. cs:line 90
at GEK_Release_1.M odule1.Main(Str ing[] CmdArgs) in C:\Documents and
Settings\pwg\My Documents\Visua l Studio Projects\
GEK Release 1\GEK Release 1\Module1.vb:li ne 15

I have checked and double checked everything, and it should work.. but it
keeps on failing. Any ideas?

Nov 17 '05 #4
Hi Philip,

Have you tried using another TIF file, because it might be the TIF file
error. If this is not the case, could you please post the whole class
definition here, so that I can try to repro it on my machine?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #5
Hi Philip,

Have you tried using another TIF file, because it might be the TIF file
error. If this is not the case, could you please post the whole class
definition here, so that I can try to repro it on my machine?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #6
I started this all with the tiffmanager on codeproject:
http://www.codeproject.com/csharp/TiffManager.asp I tried to splitt a
multipage tiff that was generated by combining singlepage tiff's to a group 4
encoded multipage tiff. When I try to extract the single page tiff's I get
the error:

Unhandled Exception: System.Runtime. InteropServices .ExternalExcept ion: A
generic error occurred in GDI+.
at System.Drawing. Image.Save(Stri ng filename, ImageCodecInfo encoder,
EncoderParamete rs encoderParams)
at TiffManager.Spl itTiffImage(Str ing outPutDirectory , EncoderValue format)
at ConsoleApplicat ion.Module1.Mai n(String[] CmdArgs)

I then tried the tiffsplitter in
http://www.codeproject.com/vb/net/faxeditor.asp. This even throws an error
when I try to load the multipage tiff that came with the source.

I then tried the multi page tiff example by bob powell:
http://www.bobpowell.net/addframes.htm

This gives me bufferoverflow when I try to load my group 4 encoded tiff.

If needed I can post the multipage tiff in mime format here.
Code from the TIffManager.cs

using System;
using System.IO;
using System.Drawing;
using System.Drawing. Imaging;
using System.Collecti ons;

/// <summary>
/// Summary description for TiffManager.
/// </summary>
public class TiffManager : IDisposable
{
private string _ImageFileName;
private int _PageNumber;
private Image image;
private string _TempWorkingDir ;

public TiffManager(str ing imageFileName)
{
this._ImageFile Name=imageFileN ame;
image=Image.Fro mFile(_ImageFil eName);
GetPageNumber() ;
}

public TiffManager()
{
}

/// <summary>
/// Read the image file for the page number.
/// </summary>
private void GetPageNumber()
{
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

//Gets the total number of frames in the .tiff file
_PageNumber=ima ge.GetFrameCoun t(objDimension) ;

return;
}

/// <summary>
/// Read the image base string,
/// Assert(GetFileN ameStartString( @"c:\test\abc.t if"),"abc")
/// </summary>
/// <param name="strFullNa me"></param>
/// <returns></returns>
private string GetFileNameStar tString(string strFullName)
{
int posDot=_ImageFi leName.LastInde xOf(".");
int posSlash=_Image FileName.LastIn dexOf(@"\");
return _ImageFileName. Substring(posSl ash+1,posDot-posSlash-1);
}

/// <summary>
/// This function will output the image to a TIFF file with specific
compression format
/// </summary>
/// <param name="outPutDir ectory">The splited images' directory</param>
/// <param name="format">T he codec for compressing</param>
/// <returns>splite d file name array list</returns>
public ArrayList SplitTiffImage( string outPutDirectory ,EncoderValue format)
{
string
fileStartString =outPutDirector y+"\\"+GetFileN ameStartString( _ImageFileName) ;
ArrayList splitedFileName s=new ArrayList();
try
{
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

//Saves every frame as a separate file.
Encoder enc=Encoder.Com pression;
int curFrame=0;
for (int i=0;i<_PageNumb er;i++)
{
image.SelectAct iveFrame(objDim ension,curFrame );
EncoderParamete rs ep=new EncoderParamete rs(1);
ep.Param[0]=new EncoderParamete r(enc,(long)for mat);
ImageCodecInfo info=GetEncoder Info("image/tiff");

//Save the master bitmap
string fileName=string .Format("{0}{1} .TIF",fileStart String,i.ToStri ng());
image.Save(file Name,info,ep);
splitedFileName s.Add(fileName) ;

curFrame++;
}
}
catch (Exception)
{
throw;
}

return splitedFileName s;
}

/// <summary>
/// This function will join the TIFF file with a specific compression format
/// </summary>
/// <param name="imageFile s">string array with source image files</param>
/// <param name="outFile"> target TIFF file to be produced</param>
/// <param name="compressE ncoder">compres sion codec enum</param>
public void JoinTiffImages( string[] imageFiles,stri ng outFile,Encoder Value
compressEncoder )
{
try
{
//If only one page in the collection, copy it directly to the target file.
if (imageFiles.Len gth==1)
{
File.Copy(image Files[0],outFile,true);
return;
}

//use the save encoder
Encoder enc=Encoder.Sav eFlag;

EncoderParamete rs ep=new EncoderParamete rs(2);
ep.Param[0]=new EncoderParamete r(enc,(long)Enc oderValue.Multi Frame);
ep.Param[1] = new
EncoderParamete r(Encoder.Compr ession,(long)co mpressEncoder);

Bitmap pages=null;
int frame=0;
ImageCodecInfo info=GetEncoder Info("image/tiff");
foreach(string strImageFile in imageFiles)
{
if(frame==0)
{
pages=(Bitmap)I mage.FromFile(s trImageFile);

//save the first frame
pages.Save(outF ile,info,ep);
}
else
{
//save the intermediate frames
ep.Param[0]=new
EncoderParamete r(enc,(long)Enc oderValue.Frame DimensionPage);

Bitmap bm=(Bitmap)Imag e.FromFile(strI mageFile);
pages.SaveAdd(b m,ep);
}

if(frame==image Files.Length-1)
{
//flush and close.
ep.Param[0]=new EncoderParamete r(enc,(long)Enc oderValue.Flush );
pages.SaveAdd(e p);
}

frame++;
}
}
catch (Exception)
{
throw;
}

return;
}

/// <summary>
/// This function will join the TIFF file with a specific compression format
/// </summary>
/// <param name="imageFile s">array list with source image files</param>
/// <param name="outFile"> target TIFF file to be produced</param>
/// <param name="compressE ncoder">compres sion codec enum</param>
public void JoinTiffImages( ArrayList imageFiles,stri ng
outFile,Encoder Value compressEncoder )
{
try
{
//If only one page in the collection, copy it directly to the target file.
if (imageFiles.Cou nt==1)
{
File.Copy((stri ng)imageFiles[0],outFile,true);
return;
}

//use the save encoder
Encoder enc=Encoder.Sav eFlag;

EncoderParamete rs ep=new EncoderParamete rs(2);
ep.Param[0]=new EncoderParamete r(enc,(long)Enc oderValue.Multi Frame);
ep.Param[1] = new
EncoderParamete r(Encoder.Compr ession,(long)co mpressEncoder);

Bitmap pages=null;
int frame=0;
ImageCodecInfo info=GetEncoder Info("image/tiff");
foreach(string strImageFile in imageFiles)
{
if(frame==0)
{
pages=(Bitmap)I mage.FromFile(s trImageFile);

//save the first frame
pages.Save(outF ile,info,ep);
}
else
{
//save the intermediate frames
ep.Param[0]=new
EncoderParamete r(enc,(long)Enc oderValue.Frame DimensionPage);

Bitmap bm=(Bitmap)Imag e.FromFile(strI mageFile);
pages.SaveAdd(b m,ep);
bm.Dispose();
}

if(frame==image Files.Count-1)
{
//flush and close.
ep.Param[0]=new EncoderParamete r(enc,(long)Enc oderValue.Flush );
pages.SaveAdd(e p);
}

frame++;
}
}
catch (Exception ex)
{
#if DEBUG
Console.WriteLi ne(ex.Message);
#endif
throw;
}

return;
}

/// <summary>
/// Remove a specific page within the image object and save the result to
an output image file.
/// </summary>
/// <param name="pageNumbe r">page number to be removed</param>
/// <param name="compressE ncoder">compres s encoder after operation</param>
/// <param name="strFileNa me">filename to be outputed</param>
/// <returns></</returns>
public void RemoveAPage(int pageNumber,Enco derValue compressEncoder ,string
strFileName)
{
try
{
//Split the image files to single pages.
ArrayList arrSplited=Spli tTiffImage(this ._TempWorkingDi r,compressEncod er);

//Remove the specific page from the collection
string
strPageRemove=s tring.Format("{ 0}\\{1}{2}.TIF" ,_TempWorkingDi r,GetFileNameSt artString(this. _ImageFileName) ,pageNumber);
arrSplited.Remo ve(strPageRemov e);

JoinTiffImages( arrSplited,strF ileName,compres sEncoder);
}
catch(Exception )
{
throw;
}

return;
}

/// <summary>
/// Getting the supported codec info.
/// </summary>
/// <param name="mimeType" >description of mime type</param>
/// <returns>imag e codec info</returns>
private ImageCodecInfo GetEncoderInfo( string mimeType)
{
ImageCodecInfo[] encoders=ImageC odecInfo.GetIma geEncoders();
for (int j=0;j<encoders. Length;j++)
{
if (encoders[j].MimeType==mime Type)
return encoders[j];
}

throw new Exception( mimeType + " mime type not found in ImageCodecInfo" );
}

/// <summary>
/// Return the memory steam of a specific page
/// </summary>
/// <param name="pageNumbe r">page number to be extracted</param>
/// <returns>imag e object</returns>
public Image GetSpecificPage (int pageNumber)
{
MemoryStream ms=null;
Image retImage=null;
try
{
ms=new MemoryStream();
Guid objGuid=image.F rameDimensionsL ist[0];
FrameDimension objDimension=ne w FrameDimension( objGuid);

image.SelectAct iveFrame(objDim ension,pageNumb er);
image.Save(ms,I mageFormat.Bmp) ;

retImage=Image. FromStream(ms);

return retImage;
}
catch (Exception)
{
ms.Close();
retImage.Dispos e();
throw;
}
}

/// <summary>
/// Convert the existing TIFF to a different codec format
/// </summary>
/// <param name="compressE ncoder"></param>
/// <returns></returns>
public void ConvertTiffForm at(string strNewImageFile Name,EncoderVal ue
compressEncoder )
{
//Split the image files to single pages.
ArrayList arrSplited=Spli tTiffImage(this ._TempWorkingDi r,compressEncod er);
JoinTiffImages( arrSplited,strN ewImageFileName ,compressEncode r);

return;
}

/// <summary>
/// Image file to operate
/// </summary>
public string ImageFileName
{
get
{
return _ImageFileName;
}
set
{
_ImageFileName= value;
}
}

/// <summary>
/// Buffering directory
/// </summary>
public string TempWorkingDir
{
get
{
return _TempWorkingDir ;
}
set
{
_TempWorkingDir =value;
}
}

/// <summary>
/// Image page number
/// </summary>
public int PageNumber
{
get
{
return _PageNumber;
}
}
#region IDisposable Members

public void Dispose()
{
image.Dispose() ;
System.GC.Suppr essFinalize(thi s);
}

#endregion
}

I use a vb.net console app to run it as commandline app:

Imports System
Imports System.Drawing

Module Module1

Sub Main(ByVal CmdArgs() As String)
If CmdArgs.Length = 1 Then
Dim tiffmngr As New TiffManager(Cmd Args(0))
Dim Filenames As ArrayList
tiffmngr.TempWo rkingDir = "c:\output\temp "
Filenames = tiffmngr.SplitT iffImage("c:\ou tput\temp", _
System.Drawing. Imaging.Encoder Value.Compressi onLZW)
Else
Console.WriteLi ne("TiffSplit <tif filename>")
End If
End Sub

End Module

"Kevin Yu [MSFT]" wrote:
Hi Philip,

Have you tried using another TIF file, because it might be the TIF file
error. If this is not the case, could you please post the whole class
definition here, so that I can try to repro it on my machine?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #7
Hi,

I noticed you have posted this issue in another newsgroup. One of our
enginners has posted a reply there.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2711
by: Pohihihi | last post by:
I am getting a generic GDI+ error on following code. Basically it is trying to capture screen image and save in a file. Is there a way to find more details on this error? Thanks for the help. --------------------------- ERROR MSG --------------------------- System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
2
22314
by: Alphonse Giambrone | last post by:
I am currently reading 'Programming The Web with Visual Basic .NET' and have so far found it to be excellent. Downloaded all the code from Apress and working in chapter 4, I get the error shown below. I am running IIS5 on WinXP Pro. Server Error in '/Chapter04' Application. ---------------------------------------------------------------------------- ---- A generic error occurred in GDI+. Description: An unhandled exception occurred...
13
4665
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then open that file in whatever viewer/editor is the default for the users system. I tried to do picturebox1.image.save(filename), which results in "A Generic error occured in GDI+". However, if I use an unbound picturebox, do a
8
5041
by: Philip Wagenaar | last post by:
..43Hi, I am trying to extract tiff images from a multipage tiff and save them to disk. This is becoming almost a nightmare for me. I have seen several examples on the net that talk about this. For example : http://www.codeproject.com/vb/net/faxeditor.asp THis example should work great. But when I even try to load the multipage tiff that came with the example I receive a general gdi+ error. The same for a TIffManager Class written in...
15
5367
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
0
3949
by: Robin van de Water [synthesiSFactory] | last post by:
Hi All, In one of my web applications, I intercepted the following error in the Application_Error part of the Global.Asax: GDI+ is not properly initialized (internal GDI+ error). The error as it was mentioned in the server's event viewer shows the following error message:
0
1247
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object: System.Drawing.Graphics.CheckErrorStatus(Int32 status) System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format) System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, PointF...
14
4111
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object: System.Drawing.Graphics.CheckErrorStatus(Int32 status) System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format) System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, PointF...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.