https://github.com/flexrobotics/roboflex_util_png
Roboflex in-memory compression of rgb images to and from pngs.
https://github.com/flexrobotics/roboflex_util_png
png roboflex
Last synced: 2 months ago
JSON representation
Roboflex in-memory compression of rgb images to and from pngs.
- Host: GitHub
- URL: https://github.com/flexrobotics/roboflex_util_png
- Owner: flexrobotics
- License: mit
- Created: 2023-10-19T21:24:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-03T23:59:38.000Z (over 1 year ago)
- Last Synced: 2025-01-21T16:47:08.760Z (4 months ago)
- Topics: png, roboflex
- Language: C++
- Homepage: https://github.com/flexrobotics/roboflex_util_png
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# roboflex.util.png
Roboflex support for png compression to file and memory, and png decompression from memory.
Useful for compressing images over slow transports (wifi, etc).
## System Dependencies
None! We build lodepng from source...
## pip install
pip install roboflex.util.png
## Import
import roboflex.util.png as rup
## Nodes
There are two complementary nodes: `PNGCompressor`, which can turn rgb tensors into pngs in memory, and `PNGDecompressor`, which does the opposite. Useful either for writing rgb tensors to files, or compressing them.
# all parameters are optional
c = rup.PNGCompressor(# in the incoming message, where to find the rgb tensor
image_key = "rgb",# in the outgoing message, where to place the jpeg data
output_key = "png",# If this is provided, will ALSO write jpeg files with this
# prefix, with a variation of the date and time as the suffix.
filename_prefix = "",# name of the node
name = "PNGCompressor",# prints internal info
debug = False,
)... and ...
c = rup.PNGDecompressor(
# in the incoming message, where to find the png data as a blob
input_key = "png",# in the outgoing message, where to place the rgb data as a tensor
output_key = "rgb",# name of the node
name = "PNGDecompressor",# prints internal info
debug = False,
)