Skip to content

Instantly share code, notes, and snippets.

@jcupitt
Created December 20, 2021 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcupitt/3817f8a2e4af8167b58ec08abbc83776 to your computer and use it in GitHub Desktop.
Save jcupitt/3817f8a2e4af8167b58ec08abbc83776 to your computer and use it in GitHub Desktop.
convert netvips to bitmap and back
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
using var image = NetVips.Image.NewFromFile(args[0]);
// make a System.Drawing bitmap from it
using var bitmap = NetVips.Extensions.BitmapConverter.ToBitmap(image);
// make it back into a netvips image
using var newImage = NetVips.Extensions.BitmapConverter.ToVips(bitmap);
newImage.WriteToFile(args[1]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment