This code will crop the image based on all white and transparent pixels from around the image public static Bitmap CropWhiteSpace(Bitmap bmp) { int w = bmp.Width; int h = bmp.Height; int white = 0xffffff; Func allWhiteRow = r => { for (int i = 0; i < w; ++i) if ((bmp.GetPixel(i, r).ToArgb() & white) != white) return false; return true; }; Func allWhiteColumn = c => { for (int i = 0; i < h; ++i) if ((bmp.GetPixel(c, i).ToArgb() & white) != white) return false; return true; }; int topmost = 0; for (int row = 0; row < h; ++row) { if (!allWhiteRow(row)) break; topmost = row; } int bottommost = 0; for (int row = h - 1; row >= 0; --row) { if (!allWhiteRow(row)) break; bottommost = row; } int leftmost = 0, rightmost = 0; for (int col = 0; col < w; ++col) { if (!allWhiteColumn(col)) break; leftmost = col; } for (int col =
Scenarios: -If you get the following errors: Could not load file or assembly Microsoft.ReportViewer.Common Could not load file or assembly Microsoft.ReportViewer. ProcessingObjectModel Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
With some versions of Visual studio when you try to make version auto number sometimes it get an error like : Error CS8357 The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation Solution : Unload Project from visual studio and edit .csproj file Or open .csproj solution file in editor. Search for tag and Change value from true to false Save file and reload project again inside Visual studio <propertygroup> <configuration condition=" '$(Configuration)' == '' ">Debug</configuration> <platform condition=" '$(Platform)' == '' ">AnyCPU</platform> <projectguid>{76602FA1-9AD8-4014-BA5D-2E9128C19AB2}</projectguid> <targetframeworkversion>v4.7</targetframeworkversion> <filealignment>512</filealignment> <a
Comments
Post a Comment