I am using the below code for converting a png image in local path(D:\CURR PROJECT\NewUIChanges\Htmlfile\round1.png)to bytes.I am getting a null execption ie)img stream is null.Plz hep me.
Stream imgStream;
imgStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NewUIChanges.Htmlfile.round1.png");
byte[] data = new byte[(int)imgStream.Length];
int offset = 0;
while (offset < data.Length)
{
int bytesRead = imgStream.Read(data, offset, data.Length - offset);
if (bytesRead <= 0)
{
throw new EndOfStreamException("Stream wasn't as long as it claimed");
}
offset += bytesRead;
}
Change the build action of the image to Embedded Resource.