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 allWhiteColumn = c => { for (int i = 0; i = 0; --row) { if (!allWhiteRow(row)) break; bottommost = row; } int leftmost = 0, rightmost = 0; for (int col = 0; col = 0; --col) { if (!allWhiteColumn(col)) break; rightmost = col; } if (rightmost == 0) rightmost = w; // As reached left if (bottommost == 0) bottommost = h; // As reached top. int croppedWidth = rightmost - leftmost; int croppedHeight = bottommost - topmost; if (croppedWidth == 0) // No border on left or right { leftmost = 0; croppedWidth = w; } if (croppedHeight == 0) // No border on top or bottom { topmost = 0; croppedHeight = h; } try { var target = new Bi...
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