Questions tagged [imagesharp]

A cross-platform library for the processing of image files; written in C#

ImageSharp is a new, fully featured, fully managed, cross-platform, 2D graphics API.

Designed to democratize image processing, ImageSharp brings you an incredibly powerful yet beautifully simple API.

Compared to System.Drawing we have been able to develop something much more flexible, easier to code against, and much, much less prone to memory leaks. Gone are system-wide process-locks; ImageSharp images are thread-safe and fully supported in web environments.

Built against .Net Standard 1.1 ImageSharp can be used in device, cloud, and embedded/IoT scenarios.

Documentation and Code Respository

https://sixlabors.github.io/docs/

https://github.com/SixLabors/ImageSharp

164 questions
25
votes
2 answers

How to Resize Center and Crop an image with ImageSharp

I need to convert some System.Drawing based code to use this .NET Core compatible library: https://github.com/SixLabors/ImageSharp The System.Drawing based code below resizes an image and crops of the edges, returning the memory stream to then be…
Darren
  • 9,014
  • 2
  • 39
  • 50
11
votes
2 answers

ImageSharp and Font Height

I have a task to create an image that will be printed. On the picture, I need to put a single uppercase letter (Upper case, [A-Z]). The printed image size can vary between 15cm height, and 30cm height (including any size in between). The letter…
Craig
  • 18,074
  • 38
  • 147
  • 248
10
votes
1 answer

Convert ImageSharp.Image to ImageSharp.PixelFormats.Rgba32?

I am following a tutorial (https://opentk.net/learn/chapter1/4-textures.html) using ImageSharp. How do I convert the type 'ImageSharp.Image' to 'ImageSharp.PixelFormats.Rgba32'? To load the Image, I am using Image image = Image.Load(path);…
Tiarnan
  • 115
  • 1
  • 10
10
votes
2 answers

Detect picture format with SixLabors ImageSharp

How do I get the image format using SixLabors.ImageSharp? In version 1.0.0-alpha9-00152 I could use: Image image = Image.Load(GetBytesFromBlobStorage()); IImageFormat format = image.CurrentImageFormat; but .CurrentImageFormat() doesn't seen…
Andre Odendaal
  • 557
  • 6
  • 19
9
votes
1 answer

Using ImageSharp what's the best way to convert incoming buffer containing Bgra32 to an ImageSharp Image image?

I get PixelFormats.Bgra32 images from UAP and WPF and I would like to know the fastest way to convert them to and from SixLabors.ImageSharp Image images. Is there some magic "mutate" that can flip the pixel bytes after I've copied the buffer…
Chris
  • 1,101
  • 8
  • 13
9
votes
1 answer

How use ImageSharp(Web) to compress / mutate stream with images(IFormFile)

I am trying to compress image(usually around 5-30) quality / size with ImageSharp.Web() library, and I cant really understand how can I do that or what I am missing here. Can I reuse the same memory stream / IFormFile object to save the mutated…
kerpekri
  • 346
  • 7
  • 19
9
votes
1 answer

PdfSharpCore image rendering issue

Completely unable to render JPEG image to PDF using PdfSharpCore. Code is as simple as public byte[] GetPdfContent() { ImageSource.ImageSourceImpl = new ImageSharpImageSource(); var document = new PdfDocument(); var logo =…
Ivan Zverev
  • 327
  • 2
  • 14
9
votes
2 answers

Convert Image to Byte[] using ImageSharp

How can I convert an image to array of bytes using ImageSharp library? Can ImageSharp library also suggest/provide RotateMode and FlipMode based on EXIF Orientation?
dudedev
  • 451
  • 1
  • 5
  • 19
8
votes
2 answers

Rotate/Flip image using EXIF data of image in aspnetcore web api

I have a web application on which users can upload profile picture by taking the picture directly by mobile phones. Because of EXIF orientation of the images, the frontend must transform image (rotate/flip) before showing the picture. However, I…
dudedev
  • 451
  • 1
  • 5
  • 19
7
votes
1 answer

Using C# to measure the width of a string in pixels in a cross platform way

I have some existing C# code that uses System.Drawing.Common to measure the approximate width of a string in pixels: var text = "abc123 this is some long text my dog's name is fido."; using (var bitmap = new Bitmap(500, 50)) using (var graphics =…
Jon Sagara
  • 1,122
  • 2
  • 11
  • 16
7
votes
1 answer

Create an image from byte[] using ImageSharp

I have a byte[] and I want to create a gray-scale image using ImageSharp library. That is how I am doing it currently: byte[] arr = MnistReader.ReadTestData(); //this gives me byte[] with 784 pixel values ImageSharp.Image image = new…
koryakinp
  • 3,989
  • 6
  • 26
  • 56
6
votes
2 answers

unable to process .jpg images using SixLabors.ImageSharp in c# - Version 1.0.0-beta0007

I am unable to save the jpg image using SixLabors.ImageSharp version - 1.0.0-beta0007 in c#, It throws error. Is there any solution to fix the issue beside GIF,PNG,JPEG,BMP format images. Throws Exception: Image cannot be loaded. Available…
Jay Raj Mishra
  • 110
  • 2
  • 9
6
votes
1 answer

ImageSharp drawing shapes on image in Core 2.2

I am using ImageSharp (ver 1.0.0-beta0006) in my .Net Core 2.2 project. I primarily use it to resize image (to generate thumbnail) and it's working fine. Recently, I've got a requirement to draw rectangles on the image. Based on the documentation,…
VT Chiew
  • 663
  • 5
  • 19
6
votes
1 answer

How to create barcode image with ZXing.Net and ImageSharp in .Net Core 2.0

I'm trying to generate a barcode image. When I use the following code I can create a base64 string but it's giving a blank image. I checked the content is not blank or white space. There are codes using CoreCompat.System.Drawing but I couldn't make…
ilker unal
  • 502
  • 1
  • 6
  • 15
5
votes
2 answers

Inserting ImageUniqueID into a JPEG's EXIF data without modifying the image using .NET

I have a requirement to insert a unique ID into image files without modifying the image content – ie it’s just the metadata that I want to modify. I’m starting with the JPEG files because there is an appropriate EXIF property available:…
CrispinH
  • 1,899
  • 4
  • 23
  • 38
1
2 3
10 11