Questions tagged [system.drawing]

System.Drawing is a namespace of the .NET framework. It provides access to GDI+ basic graphics functionality.

0
votes
1answer
19 views

.NET Standard 2.0 library referenced by .NET 4.6.1 project - Wrong version of Drawing library referenced

I am trying to get a .NET standard 2.0 library (that uses System.Drawing) to be referenced by a .NET 4.6.1 project (that implements a function that passes the ImageFormat enum). I get the following ...
0
votes
0answers
25 views

System.Drawing.Graphings.SmoothingMode getter throws ArgumentException “Parameter is not valid”

I have a large and resource intensive C# GUI application which uses the DotNetBar 3rd party UI library. Occasionally, it fails with the following exception and call stack: =========================...
0
votes
0answers
20 views

Get screen resolution of Microsoft surface using c#? [duplicate]

I want to create desktop application that requires screen resolution. for that i have tried this. var rectangle = new Rectangle(); foreach (var screen in System.Windows.Forms.Screen....
1
vote
1answer
55 views

Create 8 bit bitmap from array

I am trying to create a bitmap from an array of pixels. var height = 2; var width = 2; var output = new byte[4] { 0, 0, 0, 0 }; var gcHandle = GCHandle....
2
votes
1answer
26 views

How to plot a pixel onto Bitmap in F# or C# rather than an anti-aliased point?

I use System.Drawing and System.Windows.Forms a lot for plotting pixels to a bitmap, but I've noticed it's never actually a single pixe. It's more like a 3x3 dot with the edges blurred. How can I plot ...
6
votes
1answer
293 views

Source file is correct, actual print is moved to the right and bottom using system.drawing printing

I've inherited an application created by people who are no longer working for my employer and I'm looking into a printing issue where the output (slightly) falls off the page. It should be: But it ...
0
votes
1answer
42 views

Is Azure App Service now supporting GDI+ (System.Drawing)?

I've been dealing with deploying an API that uses System.Drawing for a few weeks. I had it running in an Azure App Service and I used to get a "GDI+ generic exception". Now, out of nowhere started ...
1
vote
0answers
37 views

Drawing a Transparent Ellipse with System.Drawing on .Net Core turns white

So I am using System.Drawing on my ubuntu 18.04 system. It works just fine but when I try to draw something transperent it is totally white. It works on Windows in VS just fine and everything else is ...
1
vote
1answer
29 views

Remove a round transparent section of an Image c#

I am creating an Circle on a bitmap but want to have a hole in it. After serching for half an hour I only found ways to crop an image to a circle. The hard thing is, that the hole in the middle should ...
0
votes
0answers
30 views

C# Selenium Web Driver is grabbing the wrong element location, but is getting the correct height and width?

I am trying to take a screenshot of a webpage I have accessed using selenium web driver. I then want to crop the screenshot to only return a specific element. This happens to be an image. I cannot ...
0
votes
0answers
31 views

PDFSharp working in editor but not in build

This is a xpost from https://answers.unity.com/questions/1548350/pdfsharp-working-in-editor-but-not-in-build.html. I'm working on a project in Unity and from within the build I need to be able to ...
2
votes
1answer
40 views

C#: Why does rotating a non invertible matrix and back again make it invertible

Consider the following test code: using System; using System.Drawing; using System.Drawing.Drawing2D; public class Program { public static void Main() { var matrix = new Matrix(123, ...
-1
votes
0answers
41 views

How to avoid that the graphics getting disposed after the DrawImage() called?

I have custom printpreview document in which I have converted the content of the screen into metafile and draw it in the pages using the below code. protected override void OnPrintPage(...
0
votes
1answer
33 views

Is System.Drawing supported in xamarin.android 8 and above?

I need to use System.Drawing and System.Drawing.Common in my Xamarin.Android project but it can't load System.Drawing.Common.dll. As I know xamarin.android 8.0 and above are .net standard 2.0 ...
0
votes
0answers
19 views

C# Drawing.Graphics FromImage OutofMemoryException when passed a Bitmap with Format16bppGrayScale

I'm passing Drawing.Graphics.FromImage a Drawing.Bitmap with its pixelformat set to Format16bppGrayScale, but this is throwing a System.OutOfMemoryException (when pixelformat is left unset, the error ...
2
votes
0answers
43 views

EMF image size and resolution differs according to the machine's scaling settings - when created in C#

I am creating EMF images in C# with scaling mode of 125% (Please refer the link updated in the bottom of the post to change the scaling mode in windows machine). The image size and resolution change, ...
0
votes
0answers
20 views

Resize (downsize) rounded image borders cut [duplicate]

I want to resize an image that has a round shape, to a very low size. For example this one: I tried to use the built-in System.Drawing rescale functions GetThumbnailImage, and also tried some ...
0
votes
0answers
29 views

C#, is Graphics.DrawImage make a copy of input bitmap?

Im working on app for my educational purposes. I want to make any image (jpg, png) from 24/32bpp to 8bpp, because i only want values from 0 to 255 in one scale (in this situation, gryascale) and i ...
0
votes
1answer
46 views

Creating a circle in the middle of a page in c# [closed]

I would like help with creating a circle in the middle of a page. The page is completely blank with nothing - no divs or anything. I have trawled the internet for answers and have found a lot but they ...
0
votes
1answer
39 views

C# System.Drawing.Bitmap throwing Out of Memory Exception when cloning

I have a Bitmap image which I am trying to clone as below: Bitmap bmpCrop = bmp.Clone(new System.Drawing.Rectangle(left, top, right - left + 1, bottom - top), bmp.PixelFormat); Sometimes this line ...
1
vote
2answers
93 views

Drawing multiple Strings with no overlapping Text

I want to print multiple different Strings on a rectangle in C#. My Problem is that the Strings are always overlapping when I print them. I can not print the whole string because every line has ...
0
votes
0answers
17 views

Workaround for large bitmaps that System.Drawing can't handle

I need to convert a 16384 x16384 image with PixelFormat = Format32bppArgb to PixelFormat.Format24bppRgb. When I try to do it like this, the IDE (set to AnyCPU) errors out with an "Argument exception:...
0
votes
1answer
47 views

WPF Image and Windows Bitmaps conversion resizes the image

I have a set of methods in my utility class. They should be converting between WPF and Windows image types but when I use them my image gets downscaled by a lot(from reviewing the code it should ...
0
votes
0answers
24 views

Convert System.Windows.Media.ImageSource to Windows.Drawing.Icon?

Is there a simple way to convert an ImageSource to Icon? My use case: I am using the Window.Icon property (which is of type System.Windows.Media.ImageSource) as the same icon for NotifyIcon.Icon (...
0
votes
1answer
128 views

MigraDoc and .NET Core 2.0

I have made a class library for PDF-generation. It is implemented using PDFshart-MigraDoc (the core package*). The class library itself is made with .NET Standard as its target framework. I can use ...
0
votes
1answer
31 views

Image Getting Stretched when trying to Resize It keeping the aspect Ratio

Im using the following code to resize an image preserving the aspect ratio public Bitmap resizeImage(System.Drawing.Image imgToResize, SizeF size) { int sourceWidth = imgToResize....
0
votes
1answer
56 views

Transforming Rectangle Coordinates to a Large Resolution Image

I'm using the following code to Transform a small rectangle coordinates to a larger one ie: A rectangle position on a small image to the same position on the larger resolution of the same image ...
0
votes
0answers
36 views

Displaying a picture in an image control from stream

I created a page ImageResizer.aspx that calls the function ResizeImage(bmSource, intWidth) on Page_Load and resizes the image and returns the output as Drawing.Bitmap Private Sub ImageResizer_Load(...
1
vote
2answers
116 views

CoreCompact.System.Drawing implementation

I know I'm being thick but I am having trouble implementing a new 'using' directory for my .NET Core project. I have downloaded the necessary files for CoreCompact.System.Drawing (https://github.com/...
0
votes
0answers
35 views

C# DrawString() whitespace between letters [duplicate]

I'm trying to programmatically draw the date in the center of an image. So far, this works: Font font = new Font("Arial", fontsize); string[] datestrings = new string[] { dt.ToString("MMMM").ToUpper(...
1
vote
0answers
30 views

C# Bitmap.Save() gives a GDI+ generic error with Format16BppIndexed and no given method works [duplicate]

I am trying to write to a 16 bit grayscale image in C# and everything is fine, but when I try to save it, it gives me a generic GDI+ error. here is the code: byte [] data = new byte [200 * 100 * 2];...
2
votes
1answer
43 views

How to set Page title for page with content type “image/jpeg”

I created a page GetImage.aspx of ContentType="image/jpeg" that displays an image. Page.Response.ContentType = "image/jpeg" Page.Response.Flush() However, when I download the image, the image is ...
0
votes
0answers
18 views

64/32bpp BitmapData byteprocessing

I was doing some system for use bitmapdata of 64/32bpp images and i don't know if this bitwise operations are right. Marshal.Copy(pointer, bytePixelData, 0, bytePixelDataLength); if (bytesPerPixel ==...
1
vote
1answer
33 views

Display resized image as a return value and not as page content

On Page_Load, I want the page to display an image the same way it displays when you "Open image in a new tab". In other words, I want the page to display as content type Image/jpeg instead of ...
-1
votes
1answer
25 views

Center crop image while using C# System.Drawing to generate thumbnail

I have a scenario where I am generating a thumbnail using System.Drawing by resizing the original image to a provided size (size being used ). If the source image is a rectangle, the resulting ...
0
votes
2answers
46 views

I am trying to show background red for expiring items in my gridview but not able to using asp.net

I have a gridview that I am binding on my page_load event. In that, is a expiry date column where I want t show in red colour for those which are expiring in and under 30 days. Below is my ...
0
votes
0answers
31 views

Parameter Not Valid error in JpegBitmapDecoder

The error An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll Additional information: Parameter is not valid. Occurs in the line decoder = new JpegBitmapDecoder(...
2
votes
2answers
57 views

How to add another picture of the same picture to my form on button click using C#?

I've created a windows form that when I click on a button, it shows a panda moving. It works when I add one Panda, but I want another panda to appear on button click. I'm trying to when I click the ...
0
votes
1answer
112 views

Converting RGB value into ColorMatrix

I would like to colorize a black-white image. To do that, I use a ColorMatrix. For example, when I want to color the image red, I use this ColorMatrix: 1,0,0,0,0, 0,1,0,0,0, 0,0,1,0,0, 0,0,0,1,0, 1,...
-1
votes
1answer
93 views

Invalid Parameter

I have specific problem and i dont know how to solve it. I has been made program in winforms which taking all time screenshoots in Task. Its work about few minutes and crashes. private ...
0
votes
0answers
16 views

Removal of rounding from the Panel

I found a topic on the page such as: "Custom GroupBox with round edges" Link: Custom GroupBox with round edges and I am trying to remove it from rounding but it does not give me good results. ...
0
votes
0answers
162 views

Error System Drawing Common Asp.Net Core

I Install System.Drawing.Common version 4.5.0-preview2-26406-04 with Manage NuGet Package and after publish in my server When I run project, I get this error Error: An assembly specified in the ...
0
votes
2answers
56 views

Drawing an inner circle within a Winform label as big as possible in c#

I have a WinForms label and I am trying to draw an inner circle (not filled) within a label as big as possible. I have tried two methods, one method applied to label1, and another one applied two ...
2
votes
1answer
74 views

Is there a drop-in replacement for System.Drawing.Graphics with the same public interface?

We have an aging .NET Windows desktop marine navigation application that does some moderately complex rendering of S-57 marine vector charts (maps), ships, predictors and various navigation objects ...
0
votes
0answers
46 views

Engrave text on image in c#

So I'll probably get scolded for asking such a broad question but it's worth a shot since google and stack overflow haven't really given me an answer. I work for a funeral service company (depressing ...
0
votes
0answers
47 views

System.Drawing.Image swaps the width and height for portait images

I have an image, the dimensions are 1440 (width), 2560(height), so it is portrait. However, System.Drawing.Image method return the width as 2560 and height as 1440. I have tried different ways for ...
1
vote
3answers
84 views

Drawing a linkage or a path between two lines using c#

I am trying to draw a path between 2 lines like the following one. I used the following code to do that Pen usedpen= new Pen(Color.Black, 2); //Point[] p = { // new Point(...
0
votes
0answers
37 views

Tiff file to Bmp Format4bppIndexed C#

I implemented this function in C#: public Bitmap TIFFTOBITMAP(string inputName) { Stream imageStreamSource = new FileStream(inputName, FileMode.Open, FileAccess.Read, FileShare.Read); ...
2
votes
2answers
256 views

System.Drawing.Bitmap not recognised in Visual Studio 2017

I am writing a project in F# that uses the Bitmap functionality of System.Drawing, NET Standard 2.0, but the project can't be built because The type 'Bitmap' is not defined in 'System.Drawing'. I ...
1
vote
1answer
214 views

Can not use System.drawing.common in Mono.Android and Xamarin.ios

I am using System.drawing.common in my project, and it worked fine in .net core. Now I am trying to use System.drawing.common in Mono.Android project and Xamarin.ios project. Some problem occured: 1,...