Re: Unable to use FAXCOMLib with certain TIFF formats.



Is your bitmap monochrome? Only mono bitmaps can be saved as CCITT4. THe PixelFormat must be PixelFormat.Format1bppIndexed

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Orbian" <orbian123@xxxxxxxxxxx> wrote in message news:1123722464.607311.39230@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for the response. I had to modify your code snippet slightly
since I was unable to find a GetEncoderInfo function but I believe it
is similar to what I added. The problem is when I use the CCITT4
compression I get an "Invalid parameter" exception. Am I missing
something?


ImageCodecInfo info=null;
foreach(ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders())
{
if(ice.MimeType=="image/tiff")
{
info=ice;
}
}

EncoderParameters ep = new EncoderParameters(2);

ep.Param[1] = new EncoderParameter(Encoder.SaveFlag,
(long)EncoderValue.MultiFrame);
ep.Param[0] = new EncoderParameter(Encoder.Compression,
(long)EncoderValue.CompressionCCITT4);

m_Bmp.Save("test.tif", info, ep);


Thanks Bob Herzberg



Alex Feinman [MVP] wrote:
I see. As far as I know, attempting to send a document with any extension
but .tif will result in it being printed to fax printer driver to convert it
to tiff. For TIFF files a validation is done. If the validation fails, the
method call will fail too - there will be made no attempt to print it. Two
choices - either rename your document to .PNG (no matter that it's still
tiff inside - it wil lbe printed properly since the printing application
sniffs the stream rather than trusts file extensions), or try to ensure
compatibility of your image.


The things that the Fax library cares about are primarily resolution,
bit-per-pixels and encoding. From the first glance I can tell you that your
document has resolution of 100x100 instead of 204x98 or 204x196
Open your tif file using MS Office Document Imaging application and under
View check the page properties. Compression needs to be either CCITT3 or
CCITT4. If it is LZW, you won't be able to fax it.


If you are using System.Drawing.Imaging.Encoder to save the bitmap, you will
need the following code:


EncoderParameters ep = new EncoderParameters(2);

ep.Param[1] = new EncoderParameter(Encoder.SaveFlag,
(long)EncoderValue.MultiFrame);

ep.Param[0] = new EncoderParameter(Encoder.Compression,
(long)EncoderValue.CompressionCCITT4);

myBitmap.Save(fileName, GetEncoderInfo(ImageFormat.Tif­f), ep);


-- Alex Feinman --- Visit http://www.opennetcf.org "Orbian" <orbian123@xxxxxxxxxxx> wrote in message news:1123708127.736302.284600@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > > Alex Feinman [MVP] wrote: >> Could you post the code you use to submit the TIFF as a fax? Normally >> even >> tiff files will be subject to printing to fax printer driver, so there >> should be no difference between native and generated files >> >> -- >> Alex Feinman >> --- > > > Here is the code I send the fax with. Again, it only works with TIFF > files generated by the fax server, or if I run it in a Windows Form > application. It fails on DotNet generated files when invoked from a web > service. > > private bool SendFax(string faxnum, string fname) > { > string host = null; > int jobID; > > FAXCOMLib.FaxServerClass fserver = new FAXCOMLib.FaxServerClass(); > FAXCOMLib.FaxDoc doc; > > fserver.Connect(host); > > doc = (FAXCOMLib.FaxDoc)fserver.CreateDocument(fname); > > doc.FaxNumber = faxnum; > jobID = doc.Send(); > > return(true); > > } > > > Thanks, > Bob Herzberg >

.



Relevant Pages

  • Re: colors are slightly off importing gifs and bmps
    ... like DecompressImageIndirect does not handle DIBs with compression set to ... Unfortunately the only way to get a true 16bit bitmap is to ... As a result in CF it is impossible to draw a pure white pixel - only ... >> Alex Feinman ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Image colors altered on Pocket PC
    ... > Bertrand Fontaine ... >> As it is during the decompression the colors are reduced from whatever ... And if you attempt to load an uncompressed bitmap saved as 5:6:5, ... >> Alex Feinman ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Loading a bitmap from a .net resource as a HBITMAP
    ... "Alex Yakhnin" wrote in message ... >>I think the easiest way would be reading the bitmap data stream from ... >>resource, copying it into a temporary file and then using SHLoadImageFile. ... >> Alex Feinman ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Unable to use FAXCOMLib with certain TIFF formats.
    ... Alex Feinman wrote: ... > but .tif will result in it being printed to fax printer driver to convert it ... For TIFF files a validation is done. ... It fails on DotNet generated files when invoked from a web ...
    (microsoft.public.win2000.fax)
  • Re: Converting a byte array to a bmp
    ... I've tried using your bitmap converting code along with a version by ... Alex Feinman and another by Microsoft to save raw image data from my ... rx3715 built in ipaq camera to a bitmap. ...
    (microsoft.public.dotnet.framework.compactframework)