title: How to convert png image to jpg format in Flutter?
body: <p>I'm looking for ways through which I can convert png images to jpg format in flutter as I'm unable to find a way to do that anywhere.</p>
  <p>This is the code I tried but it is giving me black images:</p>
  <pre class="lang-dart prettyprint-override"><code>// Read a jpeg image from file.
   img.Image image = img.decodeImage(File(pngfilepath).readAsBytesSync());
  
  // Resize the image to a 200 height thumbnail (maintaining the aspect ratio).
   img.Image thumbnail = img.copyResize(image, height: 200);
  
  // Save the thumbnail as a JPG.
   File(outputfilepath/filename.jpg)
     ..writeAsBytesSync(img.encodeJpg(thumbnail));
  </code></pre>
  <p>So, please provide me a way in which I can convert png to jpg. Thank you.</p>