mirror of https://github.com/SixLabors/ImageSharp
1 changed files with 32 additions and 0 deletions
@ -0,0 +1,32 @@ |
|||||
|
## 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? |
||||
|
` |
||||
|
using (Image<Rgba32> image =Image.Load<Rgba32>($"{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? |
||||
|
` |
||||
|
using (Image<Rgba32> image = Image.Load<Rgba32>($"{filename}.png")) |
||||
|
{ |
||||
|
image.Mutate(x=>x.BlackWhite()); |
||||
|
image.Save($"{filename}blackWhite.png"); |
||||
|
} |
||||
|
` |
||||
|
## How do I access the individual pixels of an image? |
||||
|
|
||||
|
` |
||||
|
using (Image<Rgba32> image = Image.Load($"{filename}.png")) |
||||
|
{ |
||||
|
var imageHeight = image.Height;//pixel height |
||||
|
var imageWidth = image.Width; |
||||
|
var pixels =image[200,200];//<1 1 1 1> |
||||
|
var pixels2 = image[125, 180];//<0.7647059 0.7647059 0.7647059 1> |
||||
|
} |
||||
|
` |
||||
Loading…
Reference in new issue