I'm trying to get picture from Camera using image_picker library, then I want to add information of the date and time the picture was taken into the image..? Is that possible..? Thank you..
You can draw string into image using image 2.1.12
You have to import below library in your dart file
import 'package:image/image.dart' as img;
Function for capture image and draw string on image
Future<File> drawTextOnImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.camera);
var decodeImg = img.decodeImage(image.readAsBytesSync());
img.drawString(decodeImg, img.arial_48, 0, 0, DateTime.now().toString());
var encodeImage = img.encodeJpg(decodeImg, quality: 100);
var finalImage = File(image.path)..writeAsBytesSync(encodeImage);
return finalImage;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With