title: raw bitmap data to jpeg or png C++
body: <p>I have bytearray where every three bytes describes 1 pixel (RGB). The task is to convert it to jpeg or png. </p>
  
  <p>Actually, I am using Zint (open source lib for generating barcodes) that uses libpng to generate image file and save it to file system, but in Zintthe function png_plot() except generating image also save it on disk which is undesirable.</p>
  
  <p>As result I think there two ways:<br/>
  1. from bitmap bytearray to bmp -> jpeg / png (using some other lib)<br/>
  2. writing hook or some similar to png_plot()<br/></p>
  
  <p>Can you give me some advices?
  Thank you.</p>
  
  <p>Upd: for @peacemaker</p>
  
  <pre><code>
  FILE *f;<br/>
  zint_symbol *my_symbol;<br/>
  my_symbol = ZBarcode_Create();<br/>
  
  ZBarcode_Encode_and_Buffer(my_symbol, (unsigned char *)argv[1], 0, 0);<br/>
  f = fopen("bitmap.bmp", "w");<br/>
  fwrite(my_symbol->bitmap, sizeof(*(my_symbol->bitmap)), my_symbol->bitmap_height * my_symbol->bitmap_width, f);<br/>
  ZBarcode_Delete(my_symbol);<br/>
  fclose(f);<br/>
  </code></pre>