Tag Archives: Save

Max SDK Save (Write) Image (jpg,png,dds etc.) File with C#

Max SDK Save (Write) Image (jpg,png,dds etc.) File with C#

This function writing Image File.Max SDK.Autodesk.Max.dll must be added to references.

/// <summary>
/// This function writing bitmap File
/// </summary>
/// <param name="bitmap">Bitmap properties</param>
/// <param name="global">Your Global</param>
/// <param name="outputPath">File writing location</param>
public void SaveBitmap(IBitmap bitmap,IGlobal global,string outputPath)
{
	IBitmapInfo bitmapInfo = global.BitmapInfo.Create();
	bitmapInfo.SetName(outputPath);
	
	//Image file format can set using this function
	/*bitmapInfo.SetType(17);
	bitmapInfo.SetDevice("DDS Image File"); */
	
	bitmap.OpenOutput(bitmapInfo);
	bitmap.Write(bitmapInfo, 0);
	bitmap.Close(bitmapInfo, 0);
	global.TheManager.DelBitmap(bitmap);
}