from bytes
Turn raw bytes back into a number you can do math with
- bytes_value
- INT
The pack's byte-conversion pair is its most niche corner, and from bytes is the half that feels like magic the first time you use it. It takes a raw bytes object - the kind of thing you'd get reading a binary file or parsing a binary protocol - and turns it back into an integer you can compare, add, or feed into the rest of your math. For anyone touching binary data in ComfyUI, it's the missing piece that lets byte values become workflow values.
What it does
It's a wrapper around Python's int.from_bytes(). Give it the bytes, tell it the byte order and whether the value is signed, and it hands back the integer. The two settings that matter:
byteorder-"big"or"little". Big-endian reads the most significant byte first (b'\x01\x00'→ 256); little-endian reads it last (b'\x01\x00'→ 1). Get this wrong and every value comes out scrambled - it's the classic binary-parsing footgun.signed-"True"or"False". Whether the top bit is a sign. With signed False,b'\xff'is 255; with signed True, it's −1.
The input is typed BYTES, a type the pack defines itself - you won't find it in core ComfyUI, so the practical flow is: pack's to bytes produces it, this node consumes it.
Inputs and outputs
bytes_value- BYTES. The raw bytes to decode.byteorder- enum,big(default) orlittle.signed- enum,False(default) orTrue.- Output
INT- the decoded integer.
Install
Part of the Basic data handling pack. ComfyUI Manager → search "Basic data handling" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart ComfyUI. Pure Python, no dependencies.
The honest framing
This node only earns its keep if your workflow actually deals in bytes - parsing headers, decoding packed numbers, round-tripping values you serialized with to bytes. If it does, from bytes is the clean way back to arithmetic. If it doesn't, you'll never touch it, and that's fine. The one real trap is byte order: if your decoded numbers are wildly wrong, you haven't got a broken node, you've got a big/little mismatch - flip it and move on.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| bytes_value | BYTES | — | |
| byteorder | COMBO | big | 2 options: big, little |
| signed | COMBO | False | 2 options: True, False |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |