I have a problem with the Image Class - or in particular the way it stores data. I need to process some images (JPG and TIFFs mainly), but have come into a problem with TIFF images. The images are stored on disc as 16-bit TIFF images - so pixel values are in the range 0-65535. Now, when I used Image.FromFile() - it reads OK and says the pixelformat is 48bpp. BUT, the data (R,G and B values) still appear to be stored as bytes. So a pixel value of (1,1,1) in the image is actually (0,0,0) in memory. I am guessing it normalises the image as r = (r / 65535) * 255; g = (b / 65535) * 255; b = (b / 65535) * 255; I do not want this and need the actual 16 bit unsigned integer values - the values close to zero (which are now truncated to zero) are VERY important. Does anyone know of a way to get this data? Thanks Barry
wibblewibblewibble
Posts
-
Image Class Problem -
How to retrieve a graphics object from an image object????I think you mean the Graphics.FromImage() method. The exception is thrown because your image contains an indexed pixel format, which is unsupported.
-
combine bitmaps ??How do you mean combine? Simply concatenate images, or alpha blend two images?
-
Image Rotation in C#Have you created a Graphics object from the image? This will effectively draw on the image, so any post-processing should also apply to the drawings.
-
regd dll'sIf it is an unmanaged DLL, I don't think there is anyway to find out. If it is managed, you can always decompile it - using, for example, the .net reflector[^]
-
Size of FolderHere is an example. http://www.codeproject.com/useritems/showdirsize.asp Barry
-
TooltipOk - sorry. For some reason I thought "\n" didn't work and had to be in a String.Format call. I can now take that of my code where I have multiple line labels!
-
TooltipWill String.Format not do it? Barry
-
matrix determinant[Message Deleted]
-
Missing Namespaces ...... sorry if this is a dumb question - but I am creating a new class library and need to use the Image class. The System.Drawing (and System.Drawing.Imaging etc) namespaces are not available and I guess this is because I have not selected a Windows Application. Is there an easy way to use these missing namespaces when creating a new class library? Thanks Barry
-
the Form stop to respondI had the same problem and used seperate threads for waiting on a connection, and sending and receiving data. This frees up the main thread so the UI doesn't appear to stop responding. This link - http://staff.develop.com/woodring/dotnet/#socketsamp[^] - posted in reply to an article gives a good example, which got me going. Barry
-
Capturing a perticular part of an ImageI am new to C# and .net so there may be a more elegant solution , but the you could do it is as follows; // assume IA is a rectangle that defines the area // of the image you want to crop to and the original // image is in origImage......... Bitmap bmp_cropped = new Bitmap(IA.width, IA.height); Graphics g = Graphics.FromImage(bmp_cropped); g.DrawImage(origImage, 0, 0, IA, GraphicsUnit.Pixel); Hope this is of use. Barry
-
double [] via tcp/ipHi I was wondering if anyone has any idea how to solve the following (I am coming from a C background and trying to tackle this in C#). I have a TCP/IP client/server implemented. Everything that I have seen requires the data to be sent in a byte array (or as a single byte). I need to be able to send an Int32 (i.e. a 4-element byte array represenation of the integer) or a vector of double (or float) values. I haven't been able to find anything that will allow me to copy an integer/float into it's equivalent byte representation (for example the equivalent of memcpy in C). Any pointers would be greatly appreciated! Thanks Barry