Created
December 20, 2021 17:00
-
-
Save jcupitt/3817f8a2e4af8167b58ec08abbc83776 to your computer and use it in GitHub Desktop.
convert netvips to bitmap and back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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