Not tested, but try changing
string A = @"data:image/png;base64," + Convert.ToBase64String(File.ReadAllBytes(FileDir)).TrimEnd('=').Replace('+', '-').Replace('/', '_');//Convert.ToBase64String(imageArray);//;
and replacing it with
StreamReader sr = new StreamReader(FileDir);
string A = sr.ReadToEnd();
sr.Close();