All Projects → kleisauke → Net Vips

kleisauke / Net Vips

Licence: mit
.NET binding for libvips

Projects that are alternatives of or similar to Net Vips

Imaginary
Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing
Stars: ✭ 4,107 (+2273.99%)
Mutual labels:  image-processing, libvips
Imgproxy
Fast and secure standalone server for resizing and converting remote images
Stars: ✭ 5,688 (+3187.86%)
Mutual labels:  image-processing, libvips
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+12114.45%)
Mutual labels:  image-processing, libvips
Mort
Storage and image processing server written in Go
Stars: ✭ 420 (+142.77%)
Mutual labels:  image-processing, libvips
Images
Source code of images.weserv.nl, to be used on your own server(s).
Stars: ✭ 798 (+361.27%)
Mutual labels:  image-processing, libvips
Cppsharp
Tools and libraries to glue C/C++ APIs to high-level languages
Stars: ✭ 2,221 (+1183.82%)
Mutual labels:  bindings, mono
Govips
A lightning fast image processing and resizing library for Go
Stars: ✭ 442 (+155.49%)
Mutual labels:  image-processing, libvips
Retinal
🏙 Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered
Stars: ✭ 208 (+20.23%)
Mutual labels:  image-processing, libvips
Embeddinator 4000
Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
Stars: ✭ 735 (+324.86%)
Mutual labels:  bindings, mono
Ruby Vips
Ruby extension for the libvips image processing library.
Stars: ✭ 638 (+268.79%)
Mutual labels:  image-processing, libvips
Libvips
A fast image processing library with low memory needs.
Stars: ✭ 6,094 (+3422.54%)
Mutual labels:  image-processing, libvips
Skrop
Image transformation service using libvips, based on Skipper.
Stars: ✭ 71 (-58.96%)
Mutual labels:  image-processing, libvips
Dockerfile Libvips
🌄 All libvips dependencies & libvips built from source
Stars: ✭ 26 (-84.97%)
Mutual labels:  image-processing, libvips
Dali
An image processor service
Stars: ✭ 119 (-31.21%)
Mutual labels:  image-processing, libvips
Php Legofy
Transform your images as if they were made out of LEGO bricks.
Stars: ✭ 161 (-6.94%)
Mutual labels:  image-processing
Image Compressor
[Deprecated] No longer maintained, please use https://github.com/fengyuanchen/compressorjs
Stars: ✭ 167 (-3.47%)
Mutual labels:  image-processing
Pdftabextract
A set of tools for extracting tables from PDF files helping to do data mining on (OCR-processed) scanned documents.
Stars: ✭ 1,969 (+1038.15%)
Mutual labels:  image-processing
Flickr Downloadr Gtk
A cross-platform desktop app, written in Mono that would download (all or selected) photos from your photostream in their selected size along with their description, title and tags.
Stars: ✭ 159 (-8.09%)
Mutual labels:  mono
Nuxt Imagemin
Nuxt module to minify your images. Works with: png, jpeg, gif, and svg
Stars: ✭ 170 (-1.73%)
Mutual labels:  image-processing
Transformers
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.
Stars: ✭ 167 (-3.47%)
Mutual labels:  image-processing

NetVips

NuGet CI status (x64 Linux, macOS and Windows) CI status (Linux ARM64v8) CI status (NetVips nightly packaging)

This NuGet package provides a .NET binding for the libvips image processing library.

This binding passes the vips test suite cleanly with no leaks on Windows, macOS and Linux.

We have formatted docs online here:

https://kleisauke.github.io/net-vips/

How it works

Programs that use NetVips don't manipulate images directly, instead they create pipelines of image processing operations building on a source image. When the end of the pipe is connected to a destination, the whole pipeline executes at once, streaming the image in parallel from source to destination a section at a time.

Because NetVips is parallel, it's quick, and because it doesn't need to keep entire images in memory, it's light. For example, the NetVips benchmark:

NetVips.Benchmarks

Loads a large image, shrinks by 10%, sharpens, and saves again. On this test NetVips is around 14 times faster than Magick.NET and 5 times faster than ImageSharp.

The libvips documentation has a chapter explaining how libvips opens files which gives some more background.

Supported platforms

  • .NET Framework (4.5 and higher)
  • .NET Core (.NETStandard 2.0 and higher on Windows, Linux and macOS)
  • Mono

Install

You need the libvips shared library on your library search path, version 8.2 or later. There are separate NuGet packages that will contain the pre-compiled libvips binaries for the most common platforms (see this repo for details):

NuGet Package¹
Windows 64-bit NetVips.Native.win-x64
Windows 32-bit NetVips.Native.win-x64
Windows ARM64 NetVips.Native.win-arm64
Linux x64 glibc² NetVips.Native.linux-x64
Linux x64 musl³ NetVips.Native.linux-musl-x64
Linux ARM64v8 NetVips.Native.linux-arm64
Linux ARMv7 NetVips.Native.linux-arm
macOS x64 NetVips.Native.osx-x64

¹ The version number of these NuGet packages is in sync with libvips' version number.
² Uses glibc as the standard C library (Ubuntu, Debian, etc).
³ Uses musl as the standard C library (Alpine, Gentoo Linux, etc).

Then just install this package, perhaps:

Install-Package NetVips

To test your install, try this test program:

if (ModuleInitializer.VipsInitialized)
{
    Console.WriteLine($"Inited libvips {NetVips.Version(0)}.{NetVips.Version(1)}.{NetVips.Version(2)}");
}
else
{
    Console.WriteLine(ModuleInitializer.Exception.Message);
}
Console.ReadLine();

If NetVips was able to find the libvips shared library, you should see:

Inited libvips [VERSION_NUMBER]

However, if you see something else, NetVips was unable to initialize libvips. This can happen for a variety of reasons, even though most of the times it's because NetVips was not able to find libvips or due to x86/x64 architecture problems:

Inner exception HRESULT Solution
DllNotFoundException 0x8007007E Make sure to add the bin folder of the libvips Windows build to your PATH environment variable (if you wish to not use the separate NuGet packages).
BadImageFormatException 0x8007000B Make sure when you target the AnyCPU platform the Prefer 32-bit option is unchecked. Or try to target x64 instead.

Example

using NetVips;

using var im = Image.NewFromFile("image.jpg", access: Enums.Access.Sequential);

// put im at position (100, 100) in a 3000 x 3000 pixel image, 
// make the other pixels in the image by mirroring im up / down / 
// left / right, see
// https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-embed
using var embed = im.Embed(100, 100, 3000, 3000, extend: Enums.Extend.Mirror);

// multiply the green (middle) band by 2, leave the other two alone
using var multiply = embed * new[] { 1, 2, 1 };

// make an image from an array constant, convolve with it
using var mask = Image.NewFromArray(new[,]
{
    {-1, -1, -1},
    {-1, 16, -1},
    {-1, -1, -1}
}, 8);
using var convolve = multiply.Conv(mask, precision: Enums.Precision.Integer);

// finally, write the result back to a file on disk
convolve.WriteToFile("output.jpg");
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].