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
5
votes
5 answers

How can I crop an image in .NET core?

I need to crop images in .NET Core. I used ImageSharp, CoreCompat, and Microsoft.Windows.Compatibility, and scanned all methods I could find. However, I'm still unable to find a method to crop my images. Resizing is there, but not cropping. How can…
4
votes
1 answer

ImageSharp and System.Drawing Jpeg encoding differences

I'm reading a .png file as a byte array and trying to encode the image as a jpeg by using both System.Drawing (Microsoft.NETCore.App 6.0.8) and SixLabors ImageSharp (3.0.1). I need the following methods to output the same file contents, so that they…
4
votes
0 answers

How to get any suitable font in ImageSharp?

I am very tired of providing fonts for my application. It would be a lot easier to have some ready-to-use fonts collection that I can use. See this //I need to add text to image, no matter what font is var fo = SystemFonts.Find("Mono"); var font =…
Kemsikov
  • 452
  • 3
  • 13
4
votes
1 answer

Release/Reduce ImageSharp Memory Usage After Use

I have created a test WPF application for the testing of SixLabors.ImageSharp to see how it performed and if it met some requirements etc before any integration into a production application. My test app consists of an Image control to display the…
Daniel
  • 369
  • 1
  • 4
  • 19
4
votes
2 answers

Create new instance of Image in C# using SixLabors.ImageSharp

I am trying to create new instance of Image class with SixLabors.Imagesharp but I got error. The system I work with used the old ImageSharp and We want to renew nuget packages and use SixLabors.ImageSharp instead. The code used to be like this: OLD…
4
votes
2 answers

Shrink image file using ImageSharp

I need to shrink every image I get that is more than 10MB. File types are png, jpg and gif. I saw that ImageSharp has an option to resize an image: Resize(new ResizeOptions { Mode = ResizeMode.Max, Size = new Size(maxFileSize) } I saw a lot…
Dani Toker
  • 406
  • 6
  • 19
4
votes
0 answers

ImageSharp extremely slow on Android devices

I'm building a Xamarin app, using ImageSharp for image manipulation. I've noticed that the ImageSharp operations are very slow in the emulator and ridiculously slow when deployed to a physical device (Galaxy Note 8). Things that are way slow: //…
Ted Nyberg
  • 7,001
  • 7
  • 41
  • 72
4
votes
1 answer

How to combine two images?

Using ImageSharp for .Net core, how can I combine 2 images side by side? e.g.: make 2 100x150px become 1 100x300px (or 200x150px)
Leonardo
  • 10,737
  • 10
  • 62
  • 155
3
votes
2 answers

Right way to parallelize pixel access across multiple images using ImageSharp

I'm trying to parallelize the processing of an image using ImageSharp. The documentation here: https://docs.sixlabors.com/articles/imagesharp/pixelbuffers.html has an example of processing two images in parallel with the following code: // Extract a…
Pete Michaud
  • 1,813
  • 4
  • 22
  • 36
3
votes
1 answer

How do I clear an Image's EXIF data with ImageSharp?

I found a GitHub issue showing how to remove an Image's exif data by setting its ExifProfile to null: SixLabors.ImageSharp.Image image = Image.Load(imagePath); //remove exif image.Metadata.ExifProfile = null; //resize image.Mutate(x =>…
mdelvecchio
  • 567
  • 1
  • 5
  • 25
3
votes
1 answer

SixLabors ImageSharp crop-resizes wrong width and height

I use SixLabors.ImageSharp to resize photo using below code: https://www.nuget.org/packages/SixLabors.ImageSharp/ ASP .NET Core 5.0 Input photo: 720x960px Expect output: 248x186px Actual result: 186x248px Why width becomes height and vice…
vNext
  • 1,102
  • 4
  • 16
  • 28
3
votes
1 answer

Is there a way to validate the transparency of an image using ImageSharp?

We have a requirement that aside from client side validation, we also need to validate the transparency of the uploaded image in MVC controller. We know we can do this using the System.Drawing library but, we're moving away from System.Drawing due…
3
votes
1 answer

Using ImageSharp to adjust levels and colors

myImage.Mutate(i => i.Saturate(2).Resize(new ResizeOptions { Mode = ResizeMode.Crop, Position = AnchorPositionMode.Center, Size = new Size(width, height) })); I am trying to convert a Photoshop job to be done by ImageSharp in my .NET Core…
keysersoze
  • 777
  • 3
  • 12
  • 27
3
votes
0 answers

Is there a better way to crop an image to a circle with ImageSharp?

I'm working with ImageSharp to do some basic image editing in my UWP app, and one of the things I need to do is to crop the image to a circle (you can assume the image is already a square). I couldn't find a Clip API that worked with anything else…
Sergio0694
  • 4,447
  • 3
  • 31
  • 58
2
votes
1 answer

ERROR Unknown App0 Marker - Expected JFIF

I am trying to convert a byte array, obtained from a Hikvision camera stream, into jpg. I use ImageSharp library. My code is as follows: using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; private static bool ByteArrayToFile(string…
Giorgos Betsos
  • 71,379
  • 9
  • 63
  • 98
1
2
3
10 11