private static Texture2D resizeTexture( string pathToImage, int width, int height, string outputFilename )
{
var args = string.Format( "-z {0} {1} {2} --out {3}", height, width, pathToImage, outputFilename );
var proc = new System.Diagnostics.Process
{
StartInfo = new System.Diagnostics.ProcessStartInfo
{
FileName = "sips",
Arguments = args,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.WaitForExit();
proc.Start();
while( !proc.StandardOutput.EndOfStream )
{
proc.StandardOutput.ReadLine();
}
var tex = new Texture2D( 0, 0 );
tex.LoadImage( File.ReadAllBytes( outputFilename ) );
File.Delete( outputFilename );
return tex;
}