문제

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