Pregunta

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

¿Fue útil?

Solución

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

Otros consejos

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 .......
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top