To enable CLR integration in SQL Server, Use follwing TSQL statment.
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE WITH OVERRIDE;
GO;
similarly for Disabling use follwing.
EXEC sp_configure 'clr enabled', 0;
RECONFIGURE WITH OVERRIDE;
GO ;
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE WITH OVERRIDE;
GO;
EXEC sp_configure 'clr enabled', 0;
RECONFIGURE WITH OVERRIDE;
GO ;
XmlTextWriter myWriter = new XmlTextWriter("result.html", null);
// Step 4: do the actual transform of Xml
private string ConvertoToString(string imagePath)
{
string text = "";
System.Drawing.Bitmap bitMap = new Bitmap(imagePath);
for (int i = 0; i < bitMap.Height; i++)
{
for (int j = 0; j < bitMap.Width; j++)
{
if (bitMap.GetPixel(j, i).A.ToString() == "255" && bitMap.GetPixel(j, i).B.ToString() == "255" && bitMap.GetPixel(j, i).G.ToString() == "255" && bitMap.GetPixel(j, i).R.ToString() == "255")
{
text = text + "0";
}
else
{
text = text + "1";
}
}
text = text + "";
}
return ( text);
}