From b6f33a9c625ae1fd1ef936f9489771357c51da88 Mon Sep 17 00:00:00 2001 From: asterixorobelix Date: Fri, 29 Dec 2017 15:06:48 +0200 Subject: [PATCH] Updated Questions and Answers (markdown) --- Questions-and-Answers.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Questions-and-Answers.md b/Questions-and-Answers.md index b2c02c0..586c0fc 100644 --- a/Questions-and-Answers.md +++ b/Questions-and-Answers.md @@ -4,24 +4,24 @@ 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"); - } +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;//pixel height @@ -29,4 +29,4 @@ using (Image image = Image.Load($"{filename}.png")) var pixels =image[200,200];//<1  1  1  1> var pixels2 = image[125, 180];//<0.7647059  0.7647059  0.7647059  1> } -` \ No newline at end of file +``` \ No newline at end of file