1

I need to convert a raw, rgb32-formatted image to a PNG with a library (written in, in order of preference, Java, C, C++) having a permissive (e.g. BSD or Apache) license.

I'm able to convert the image using FFmpeg with this call:

ffmpeg.exe -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 20x40 -i infile -f image2 -vcodec png out.png

where 20x40 is the width by the height.

But, sadly, I need to avoid FFmpeg due to its license.

I've seen people speculate that libpng could do the job, but I'm skeptical given the documentation I've seen at the libpng site. Perhaps you'll give an example.

I don't know what the rawvideo and rgb32 values mean to FFmpeg, so I asked this question.

EDIT 1: edited the ffmpeg call to show width x height.

Community
  • 1
  • 1
Brian
  • 1,351
  • 2
  • 15
  • 29
  • 1
    So long as you can extract raw image data from your input then it will be pretty straightforward to do this with libpng. – Paul R Aug 30 '11 at 19:58

1 Answers1

1

Are you sure that you can't link ffmpeg into a proprietary application? According to http://ffmpeg.org/legal.html, most of ffmpeg is available under the GNU LGPL, which lets you link with proprietary programs, as long as you follow the "license compliance checklist" and don't use the GPL-only features.

If you don't want to dynamically link, look at ImageMagick, released under the permissive Apache license. ImageMagick appears to support reading from raw RGB images (see its list of formats.) It is written in C and has Java bindings.

Mechanical snail
  • 29,755
  • 14
  • 88
  • 113
  • I'd like to avoid dynamically linking the library and would prefer to statically compile it in. (I know that when I asked the question yesterday, I allowed for dynamic linking. Sorry, Mechanical snail!) – Brian Aug 30 '11 at 19:58
  • That was my thought, but, sadly, ImageMagick could make no sense of it. – Brian Aug 30 '11 at 20:31