convert_native_img_stream 0.0.1 copy "convert_native_img_stream: ^0.0.1" to clipboard
convert_native_img_stream: ^0.0.1 copied to clipboard

Converter utility for converting ImageFormatGroup.nv21 or ImageFormatGroup.bgra8888 to jpeg file (coming from camera stream)

convert_native_img_stream #

Converter utility for converting ImageFormatGroup.nv21 or ImageFormatGroup.bgra8888 to jpeg file (coming from camera stream)

Intro #

This plugin is mainly developed for situation when you are using the ml kit or other library that are processing the frames in single plane native format (nv12 or bgra) and you want to save the exactly processed frame from CameraImage object of frame. It will help you to convert the frame into jpeg format (into memory or file)

Sample usage #

  CameraImage frame; //init your frame from stream
  Uint8List? imageBytes;
  File? imageFile;
  
  final convertNative = ConvertNativeImgStream();
  
  covertFrame() async {
    final jpegByte = await convertNative.convertImgToBytes(frame.planes.first.bytes, frame.width, frame.height);
    final jpegFile = await convertNative.convertImg(frame.planes.first.bytes, frame.width, frame.height, "/path/to/save");
  }

    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('Test'),
            ),
            body: Column(
              children: [
                if(imageBytes != null)
                  Image.memory(imageBytes!, fit: BoxFit.cover)
                if(imageFile != null)
                  Image.file(
                    imageFile,
                    fit: BoxFit.cover
                  )
              ]
            )
        ),
      );
    }
7
likes
140
pub points
87%
popularity

Publisher

unverified uploader

Converter utility for converting ImageFormatGroup.nv21 or ImageFormatGroup.bgra8888 to jpeg file (coming from camera stream)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, image, plugin_platform_interface

More

Packages that depend on convert_native_img_stream