I am trying to create a copy of an image in memory and to use this as STDIN for a console process.
Create the InMemoryCopy:
using (FileStream fs = File.OpenRead(image))
{
fs.CopyTo(inMemoryCopy);
}
Start process and input STDIN:
p.StartInfo.Arguments = " jpg:fd:0" +
" -resize 500" +
" \"" + tmpFile + "\"";
p.Start();
//Reads in pbm file.
using (var streamReader = new StreamReader(inMemoryCopy))
{
p.StandardInput.Write(streamReader.ReadToEnd());
p.StandardInput.Flush();
p.StandardInput.Close();
}
Issue I encounter is that imagemagick noww does not recognise the file as image anymore? The file used is a .jpg but from the streamReader it seems not to be written into STDIN as valid Image file?
As I am a very much newbie, I googled and searched here to find an answer but could not figure this out.
How would I read an image file into memory and use this as STDIN in the console app (e.g. imagemagick).
Many thanks for any help!