.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Twain tiff to bitmap

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :.NET Framework
I get tiff image handle frm twain. Now how should I convert it to Bitmap? static FromHbitmap doesnt workstatic internal FromGdiPlus also doesnt work .NET guy

View Complete Post

More Related Resource Links

Bitmap FromFile space "file not found"


I am using aspose.slides to create PPTx's. Some of the process involves loading jpg's from another server and including them in the presentation. This works fine in my development environment. When I upload the site to its server, the jpg loading fails.

I am trying to access jpg's on the other server by:

   oFS = New FileStream(sFile, FileMode.Open, FileAccess.Read)

This causes an access violation error when run from the server.

I also boiled the code down to reading the file directly:

   oImg = System.Drawing.Bitmap.FromFile(sFilePath)

This causes a file not found error.

We have narrowed the problem down to the fact that the File Path has a space in it. How does one solve this problem (while still keeping the space, there is a lot of legacy data)? I have tried replacing the space with %20 or +. I have tried using Server.UrlEncode. The error message always comes back with the encoding in place (like no decoding

convert jpeg to tiff


Hi all,

I need to comvert jpeg to tiff using c#.net

I have achieved this but problem is image size is increasing drastically. eg: 25 kb of jpeg image is converted to 650 kb of tiff image.

What should be done to have the same image size as of original or atleast double the image size as of original.

Please suggest me. Thanks in advance.

Bitmap to Image Control - ImageUrl


 This is my first attempt at using the drawing features of asp.net.  I just want to start simple, and create a single color bar based on a value for a single graph.  I wrote this so far, but I can't figure out how to take the bitmap I just created, and apply it to the Image Control. Do I have to save the file first, and then reload it.

Plus, my box keeps coming out pure black, I trying to fill the box with a color. 

This is part of a web custom control, in which I dynamically created an Image Control. I want to apply the bitmap I made to the image control. 


Dim imgGoogle As Image
imgGoogle = New Image
imgGoogle.ImageAlign = ImageAlign.AbsMiddle
imgGoogle.ImageUrl = cs.GetWebResourceUrl(rsType, "ice5software.BotCatcher.Google.gif")
Private Sub DrawBarGraph_Google(ByVal BarValue As Integer)

	Dim objBitmap As System.Drawing.Bitmap
	Dim objGraphics As S

encoding/decoding a string to/from bitmap


I have two methods:

Encode - takes a string, converts it to array of bytes, uses bytes to specify colors, creates a color and sets a pixel based on bytes

Decode - takes a pixel, retrieves color (R,G,B) bytes and converts them to characters, that produces a string which was previously encoded

I'm using two for loops (img height/width) to specify position and access pixels

The issue is that once display (Control Panel\Appearance and Personalization\Display) changes to anything other then "Smaller - 100%",
bytes have different values during decoding, thus different string is produced (corrupted).

If the setting is set to "Smaller - 100%" the results are normal.

What can I do to avoid that problem?

Thanks in advance

Convert doc, tiff, excel to pdf



can i have functionality in my application to conver tiff, doc,excel files to pdf?

if yes then plz mention any api, tutorial, helping material.

thanx in advance

Writing Bitmap to Response.OutputStream - Generic Error Occured in GDI+



This is what I'm trying to do when I get the error on the server (it works on my local machine):

System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image); 

Response.ContentType = "image/bmp";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp);

I don't think it can be a permissions problem because this works on the server:

System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image);

Response.ContentType = "image/jpeg";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

So how do I get this to work for a bitmap?


how to create a Bitmap with size(20000,30000) in c#

hi how to create a BitMap with size (20000,30000) using C#

Rendering a report in TIFF at 300ppi

It's amazing to me that something that should be so simple has already eaten up nearly a day. This URL : //s0550284/ReportServer?/ERecordingReports/Report1&rs:Format=IMAGE&rc:DpiX=300&rc:DpiY=300&rc:PageHeight=11in&rc:PageWidth=8.5in&rs:Command=Render Should cause a report to be rendered as TIFF at 300ppi with a page size of 8.5 x 11. Instead, what I get is a TIFF image file at 96ppi with some rediculously large page size. If I try the same URL without the page size limiters, I get exactly the same results. There seems to be absolutely no way to get the reporting engine to diverge from it's default 96ppi setting. Changing the values in the configuration files has no effect. It's as if the 96ppi value was accidentally hardcoded in the web service interface somewhere and not subject to override. Has anyone had any success trying to change the image density? Your assistance would be greatly appreciated! I'm running SSRS 2008 R2. Regards, -Tom

Displaying a System.Drawing.Bitmap in a WPF Image control

How would I convert a System.Drawing.Btimap into a comparable WPF image control so I can display in on my WPF window? Thanks

Change Bitmap Resolution and Turn Black & White

i use this method to resize bitmaps. Bitmap OriginalBM = (Bitmap)Bitmap.FromStream(fileUploader.PostedFile.InputStream); Size newSize = new Size(300, 500); Bitmap Resizebm = new Bitmap(OriginalBM, newSize); Resizebm.Save(HttpContext.Current.Server.MapPath(yourPath) + yourImage, ImageFormat.Jpeg); OriginalBM.Dispose(); My question is how can i Change Bitmap Resolution and Turn Black & White?

Bitmap drawing

I am trying to draw objects (line, etc) on a Bitmap. However, I have run into some problems: the origin of the bitmap coordinate system is at the top-left corner of the bitmap. How can I have it set to the bottom-left corner? Also, I need to draw some real world objects on this bitmap: how can I transform or map the real world coordinates on the bitmap coordinate space? Any help is really appreciated as I am totally lost on this one.

Advanced Search tiff files sharepoint 2010

hi, I have a question about advanced search in sharepoint 2010 would love if you could help me: I have a document management system that contains files of different types. Performing a standard search system finds documents, Advanced search performed on the document properties the system can not find such documents tiff. We installed ifilter tiff by the following link: http://www.borghoff.com/post/2010/04/02/Windows-TIFF-IFilter-and-SharePoint-2007.aspx But it does not work. Maybe you have another solution for me? Thank you.

How convert bitmap to Image.source ?

I hold some bitmap object in the memory  ( simple System.Drawing.Bitmap ). I want to make some wpf image control to show this bitmap. I dont want to save the bitmap to the disk and then load it as URI to the wpf image control So, How can i do this simple action ?   Thanks.

How to determine the transparency color in a Bitmap

I think I found out how to set the transparent color in a bitmap. Bitmap.MakeTransparent(Color) But how can I get the transparent color from a bitmap. BTW. I read the term "Alpha Transparency" I'm guessing that that means the alpha values of the pixel colors are not all 255. Is that correct and is that all there is to it? Are there two features in a bitmap? The transparent color and Alpha Transparency. Or are they the same? Thanks in advance  

Dithering problem with Bitmap class

I have a scanned document(black and white in color), which is typed through a word processor. So, I each letter is very crisp in the image and is not overlapping with any other character. But once I load that into Bitmap class I see that because of dithering the words get connected by gray color.   How can i make sure, that when we are loading the image in Image or Bitmap class we can avoid dithering at all. It means that if the system can find the exact color then map it otherwise leave the pixel untouched and dont fill any color(let's say leave it as white).  suneeelid2000@gmail.co

Mouse Drawing in Bitmap and repositioning bitmap

Dear Friends,                  I have made an application similar to this: http://www.bobpowell.net/simpledraw.aspx. But I have made few changes like I have used only the mouse draw option where the drawing is zoomed to specific level with Matrix transformation and I have snapped the mouse to the current mouse coordinates. The programe is working fine. Problem arises when I try to place the same bitmap in X and Y axis many time. After placing bitmap in both the axis once again repositioned the mouse like whenever the mouse is clicked on repositioned bitmaps it draws into the original bitmap and displays the image in all positioned bitmaps. I have solved the mouse back tracking issues.                   The major problem I face here is that when the mouse crosses one bitmap to another bitmap it ticks a continuous line. That is whenever mouse crosses 0th pixel to the last pixel of previous positioned bitmap or from last pixel to 0th pixel of next positoned bitmap. Whereas I need smooth mouse drawing programme with bitmaps positioned many time so that the drawn image should look continuous. I couldnt give code because it is huge.               &n

Is it possible to display 16 bit grayscale .TIFF image in WPF ?

Is there a way to display a 16 bit TIFF image in a WPF image control  ? Currently the image shows up as black. If I use freeware programs like Irfanview, the image is displayed correclty (although it is converted to 8 bit grayscale). Is there anyway to display the grayscale .tiff image in the WPF image control ?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend