I need to convert 24 bit RGB(888) image data to PNG or JPEG image (whichever possible). Need simpler approach to do this same like converting RGB888 to BMP without any compression. Would be great if it is something like adding PNG/JPEG headers to the RGB data with/without little modification. Ready to provide more details on request..

Thanks in advance..

Language/Platform : C/Linux

有帮助吗?

解决方案

Use miniz - a.k.a single C source file Deflate/Inflate compression library with zlib-compatible API, ZIP archive reading/writing, PNG writing.

其他提示

If you just need an image format then the easiest is probably ppm (or pgm for greyscale)

You just need to add a small ascii header to the uncompressed binary data and most image apps will read it.

P6   <-- magic value for binary data
# a comment if you want
640 480    <-- width x height
255      <-- max pixel value
.... binary data here .......
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top