Hi,
I am currently testing NConvert on windows, and want to avoid temporary file creation by redirecting output to the stdout. When collecting the output from stdout, the 0x0a in the output is always being converted to 0x0d+0x0a (\r\n) by Windows, which means that Windows treats the output as a string.
Can you forcibly set the output to binary (i.e., "setmode(fileno(stdout),O_BINARY)") in such case, so that Windows will not do such conversion?
Thanks!
-o stdout bug on Windows
Moderators: XnTriq, helmut, xnview
-
- Author of XnView
- Posts: 44936
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 2
- Joined: Sun Aug 12, 2018 12:11 pm
Re: -o stdout bug on Windows
There should be any conversion at all, not limited to \x0a. All \x0a has been converted to \x0d\x0a when outputting to stdout -- which means that although nconvert is outputting binary data to stdout, Windows still treats it as a normal string and perform an automatic conversion.
There are of course lots of \x0a's in an image. Windows's conversion destroys the output file.
You can reproduce this issue by executing the command in Windows's cmd.exe:
As a comparison, dcraw.exe handle this issue by refusing to output binary data to the terminal. It only works when you have redirected the output to a file by xxxxx > out.bin.
There are of course lots of \x0a's in an image. Windows's conversion destroys the output file.
You can reproduce this issue by executing the command in Windows's cmd.exe:
Code: Select all
nconvert.exe -silent -o stdout -out png xxxx.jpg > result.png
-
- Author of XnView
- Posts: 44936
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France