From ec3508d7756e6c09791704c5f3db273535f9b929 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 30 Dec 2017 18:55:45 +1100 Subject: [PATCH] Destroyed Questions and Answers (markdown) --- Questions-and-Answers.md | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 Questions-and-Answers.md diff --git a/Questions-and-Answers.md b/Questions-and-Answers.md deleted file mode 100644 index 32c902d..0000000 --- a/Questions-and-Answers.md +++ /dev/null @@ -1,34 +0,0 @@ -## Have I installed the correct Nuget package? - -See: https://github.com/SixLabors/ImageSharp/issues/418 - -## How do I convert a JPG to a PNG image? -```cs -using (Image image =Image.Load($"{filename}.jpg")) - { - image.Save($"{filename}.png"); - } -``` -ImageSharp will automatically choose the encoding based on the file extension used in the filename (eg .jpg or .png) - -## How do I convert an image to black and white? -```cs -using (Image image = Image.Load($"{filename}.png")) - { - image.Mutate(x=>x.BlackWhite()); - image.Save($"{filename}blackWhite.png"); - } -``` -## How do I access the individual pixels of an image? - -```cs -using (Image image = Image.Load($"{filename}.png")) - { - var imageHeight = image.Height;//height of image in pixels - var imageWidth = image.Width; - var pixel1 =image[200,200];//the pixel variable contains: <1  1  1  1> - var pixel2 =image[0,0]; //means top left pixel (pixels are zero indexed). Exceeding the bounds of the image would yield an exception -//Which are normalized values (a 0-1 float, instead of 0-255),the 4 values represent "Red Green Blue Alpha" in 32 bits, because Rgba32 was chosen. - var pixels2 = image[125, 180];//<0.7647059  0.7647059  0.7647059  1> - } -``` \ No newline at end of file