cxt / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

writing to stdout w/ cwebp is incorrect on windows #217

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
cwebp.exe -lossless -o - -- ao.png > ao.webp

What is the expected output? What do you see instead?
The output is:
Saving file '-'
File:      ao.png
Dimension: 120 x 144
Output:    20498 bytes
Lossless-ARGB compressed size: 20498 bytes
  * Lossless features used: PREDICTION CROSS-COLOR-TRANSFORM
  * Precision Bits: histogram=3 transform=3 cache=9
but the webp I got was 20,575 bytes which was a bit larger than it should be.

What version of the product are you using? On what operating system?
libwebp-0.4.1-windows-x86.zip
Windows 7 x64

Please provide any additional information below.
I guess cwebp writes data to stdout in text mode on windows

Original issue reported on code.google.com by eriForce on 29 Aug 2014 at 3:40

GoogleCodeExporter commented 9 years ago
dwebp correctly calls _setmode(), but it looks like we forgot it in cwebp.

Original comment by jz...@google.com on 30 Aug 2014 at 1:02

GoogleCodeExporter commented 9 years ago
btw, will cwebp support read from stdin? is it planned?

Original comment by eriForce on 30 Aug 2014 at 2:30

GoogleCodeExporter commented 9 years ago
> btw, will cwebp support read from stdin? is it planned?

There's a bug tracking this [1], but there hasn't been any work done to deal 
with the WIC side of things.

[1] https://code.google.com/p/webp/issues/detail?id=191

Original comment by jz...@google.com on 30 Aug 2014 at 2:50

GoogleCodeExporter commented 9 years ago
There were some other places with issues dealing with stdout/stdin on windows. 
These should deal with them all:

https://gerrit.chromium.org/gerrit/71398
https://gerrit.chromium.org/gerrit/71399
https://gerrit.chromium.org/gerrit/71400
https://gerrit.chromium.org/gerrit/71401

Original comment by jz...@google.com on 30 Aug 2014 at 2:52

GoogleCodeExporter commented 9 years ago
These have been merged, thanks for the report!

a614019 ExUtilReadFromStdin: (windows) open stdin in bin mode
e80eab1 webpmux: (windows) open stdout in binary mode
e9bfb11 cwebp: (windows) open stdout in binary mode
5927e15 example_util: add ExUtilSetBinaryMode

Original comment by jz...@google.com on 3 Sep 2014 at 7:25