private bool HtmlImgCompare(string html, string imgPath) { string temphtmlPath = SpecialDirectories.Temp + "\\SUITemp.html"; if (File.Exists(imgPath)) { SUIBitmap standardImg = SUIBitmap.LoadSUIBitmap(imgPath); if (standardImg == null) { throw (new SUIHtmlCompareException()); } try { SUIUtil.OutputFileFromString(html, temphtmlPath); SUIIE ie = SUIIE.CreateIEWithURL(temphtmlPath); SUIBitmap tempImg = ie.GetClientArea(); // Fix a bug: we need to assign image path to the captured temp SUIBitmap object. tempImg.Path = imgPath; //SUIIE.CleanIEProcess(); SUIImageComparer Comparer = new SUIImageComparer(); return(Comparer.Compare(standardImg, tempImg)); }catch (SUIException e) { throw(new SUIHtmlCompareException(e)); } } else { try { SUIUtil.OutputFileFromString(html, temphtmlPath); SUIIE ie = SUIIE.CreateIEWithURL(temphtmlPath); SUIBitmap tempImg = ie.GetClientArea(); //SUIIE.CleanIEProcess(); tempImg.Path = imgPath; tempImg.Save(); return(true); } catch (SUIException e) { throw (new SUIHtmlCompareException(e)); } } }