title: Getting FirebaseVisionImage from manipulated image in Flutter
body: <p>I'm trying to do some pre-processing in my image before using Firebase MLkit. Previously, I was simply loading my image and then passing it directly like this.</p>
  
  <pre><code>File file = await FilePicker.getFile(type: FileType.IMAGE);
  final FirebaseVisionImage visionImage = FirebaseVisionImage.fromFile(file);
  VisionText visionText = await textRecognizer.processImage(visionImage);
  </code></pre>
  
  <p>But now, I wanted to do some processing on the image. I did this using Flutter's <a href="https://pub.dev/packages/image" rel="nofollow noreferrer">Image package</a> like this.</p>
  
  <pre><code>import 'package:image/image.dart' as Img;
  
  File file = await FilePicker.getFile(type: FileType.IMAGE);
  Img.Image image = Img.decodeImage(file.readAsBytesSync());
  var img = Img.invert(image);
  </code></pre>
  
  <p>Now, how do I pass this new object to FirebaseVisionImage. I see that there is this function:  </p>
  
  <pre><code>FirebaseVisionImage.fromBytes(bytes, metadata)
  </code></pre>
  
  <p>I'm guessing I can get bytes from the above image object using <code>img.getBytes()</code> but I'm confused how to set the metadata.</p>
  
  <p>EDIT:
  I see that one can write the image to a temporary file doing</p>
  
  <pre><code>img.writeAsBytesSync(decoded.ToList());
  </code></pre>
  
  <p>and then use that image again using <code>FirebaseVisionImage.fromFile()</code> but I would really prefer not to do that.</p>