Solved

Get image byte array

Posted on 2012-04-09
3
314 Views
Last Modified: 2012-04-09
Given the path to the image:

pixtools_mod1.tif

Is it possible to get a reprentation of the .TIF as a byte array  (byte[ ]) ?

byte[] annotationImage;

annotationImage = foo.GetByteArray("pixtools_mod1.tif");


...something like that?

Please provide possible source code for the method GetByteArray(string pathToImage);


I will be looking for the answer as well.  :)


Thank you,

Tom
0
Comment
Question by:knowlton
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 37825629
Try something like this:
            string FileName = "pixtools_mod1.tif";
            Image img = Image.FromFile(FileName);
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            img.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
            img.Dispose();
            byte[] annotationImage = ms.ToArray();
            ms.Dispose();

Open in new window

0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 37825631
Thanks!
0
 
LVL 5

Author Comment

by:knowlton
ID: 37825635
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Latency in .net app using DB in .net 21 66
Javascript and Jquery not firing 9 50
Regular expression help 2 25
VB.Net - MemoryMappedFiles - Confirm receipt 2 20
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question