In a ContentProcessor (Pipeline Tool, MonoGame v. 3.8) I want to create a texture and save it as a png. Since System.Drawing is not cross-platform and I am getting an error when building resources “Could not load file or assembly System.Drawing.Common, Version=4.0.0.1” is there an alternative? Can’t use Texture2D because there is no GraphicsDevice available in ContentProcessor.
var bm = new System.Drawing.Bitmap( packedSprites.Width, packedSprites.Height );
for( var x = 0; x < packedSprites.Width; x++ )
{
for( var y = 0; y < packedSprites.Height; y++ )
{
var col = packedSprites.GetPixel( x, y );
var color = System.Drawing.Color.FromArgb( col.A, col.R, col.G, col.B );
bm.SetPixel( x, y, color );
}
}
var atlasFilename = tileset.name + "-atlas.png";
bm.Save( Path.Combine( tileset.mapFolder, atlasFilename ), System.Drawing.Imaging.ImageFormat.Png );