New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toBuffer() returns bgra #1416
Comments
Yeah, that's definitely confusing. Cairo describes it as:
i.e. the "upper" byte (alpha) is the 4th byte on little-endian systems like your Mac. If you're interested in gory details, Wikipedia has a lengthy section on the ambiguity of this terminology, and there are ~20 messages on the cairo mailing list starting here and here. PR welcome -- could more or less quote Cairo's description, along with a note like "on most systems (i.e. little-endian architectures), this means that the byte array is ordered [b,g,r,a,...]". Or if you prefer I can write up a PR (byte ordering is an odd fascination of mine). BTW ImageData.data is described by the spec as "RGBA" and returns the more-expected, byte-wise result (except on big-endian systems, #908). Adjusting your ffmpeg usage to work with
|
Issue or Feature
I'm seeing something weird with the
toBuffer
method: The documentation says canvas.toBuffer('raw') returnsargb
data, but it is actually returningbgra
.That's not a big deal: once I found where this came from, I simply had to change a parameter in my ffmpeg command... But maybe the doc could be updated?
By the way, thanks a lot. This tool is awesome.
Steps to Reproduce
Environment
node-canvas 2.4.1
node 10.0 on Mac OS X 10.14
The text was updated successfully, but these errors were encountered: