cloudacy / native_exif Goto Github PK
View Code? Open in Web Editor NEWA simple EXIF metadata reader/writer for Flutter.
License: MIT License
A simple EXIF metadata reader/writer for Flutter.
License: MIT License
Thanks for this package ๐
I've just tried running the example project on an Android emulator and got the following errors in my logs
/Users/mos/IdeaProjects/temp/native_exif/example/android/app/src/debug/AndroidManifest.xml Error:
android:exported needs to be explicitly specified for element <activity#com.cloudacy.native_exif_example.MainActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : android:exported needs to be explicitly specified for element <activity#com.cloudacy.native_exif_example.MainActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 7s
Exception: Gradle task assembleDebug failed with exit code 1
Hello, I'm having a problem where the image exif attributes only change in android emulator, but when I'm trying in a real smartphone (S20fe) the exif does not change or update.
Heres the code part:
final exif = await Exif.fromPath(imagefile);
debugPrint('Image file has been loaded');
final attributes = await exif.getAttributes();
await exif.writeAttribute('DateTimeOriginal', videoDate!);
if(location!=null) {
await exif.writeAttributes({
'GPSLatitude': lat,
'GPSLatitudeRef': latRef,
'GPSLongitude': lon,
'GPSLongitudeRef': lonRef,
});
}
debugPrint('Date time altered to:');
debugPrint(videoDate.toString());
debugPrint('Location altered to:');
debugPrint('$lat$latRef $lon$lonRef');
final result = await exif.writeAttributes(attributes!);
await exif.close();
debugPrint('Image attributes has been set');
Hi there,
I want to add a custom EXIF data to image selected from gallery. This is the code I have written that sets the "UserComment" attribute to "logoboa".
final Exif exif = await Exif.fromPath("${storage.path}/logo.png");
await exif.writeAttribute("UserComment", "logoboa");
print(await exif.getAttributes());
await exif.close();
When I print using exif.getAttributes(), i find that the attribute has been set as seen below:
{UserComment: logoboa, ImageWidth: 0, ImageLength: 0, Orientation: 0}
Now when i load the image later, i see that the changes are not being made:
// get the image path
String path = _image!.path;
final Exif exif = await Exif.fromPath(path);
final data = await exif.getAttributes();
print(data);
The data printed does not contain "UserComment" attribute as seen below:
{ImageWidth: 0, ImageLength: 0, Orientation: 0}
Device being used is an Android Emulator. What am I doing wrong here?
Hello,
I found this package on pub.dev but it seems that you forgot to modify the default README.md.
I almost overlooked this package because of this lack of informations on the package, so I think it would help it getting the popularity it deserves!
Regards.
Hello,
I was wondering if it would be possible to write exif data directly to an in-memory buffer, instead of having to write the file (even temporarily) to storage. Something like
final exif = await Exif.fromBytes(imageBytes);
...
final newImage = await exif.getImageBytes();
await exif.close();
would be perfect.
Hi, I'm trying to write the attribute for 'UserComment' using an Android device. It keeps showing an additional field called 'Warning' as shown below. This issue does not occur when I'm using iPhone. Any idea how to fix this? Thanks
Warning: Invalid EXIF text encoding for UserComment
Hello, I don't think its a good idea to let the dependabot to make changes on the android folder, the versions should only be increased when recommended by flutter.
in this example, it bumped the Kotlin version and its the only package that is requesting me to increment the Kotlin version on my app.
the same can be said for the gradle version being increased just recently
I use the below code to update the exif data of a picked image.
Position position = await _determinePosition();
final exif = await Exif.fromPath(_pickedImage!.path);
final file = File('${Directory.systemTemp.path}/temp.jpg');
final imageBytes = await _pickedImage!.readAsBytes();
await file.create();
await file.writeAsBytes(imageBytes);
final attributes = await exif.getAttributes();
final newExif = await Exif.fromPath(file.path);
attributes!['GPSLatitude'] = position.latitude.toString();
attributes['GPSLongitude'] = position.longitude.toString();
attributes['GPSLatitudeRef'] = "N";
attributes['GPSLongitudeRef'] = "E";
await newExif.writeAttributes(attributes);
But it did not add GPSLatitude and GPSLongitude data to the exif data. It only adds GPSLatitudeRef and GPSLongitudeRef.
I am using native_exif: ^0.2.0
package.
Good evening to everyone,
I'm using the following code to get an image from a remote address but a strange behaviour happens:
If the code is executed when the device is connected to a wireless network all it is working fine; otherwise if I use the normal 4g/5g network it simply doesn't work.
Could you give me some suggestion?
I'm using the latest version of this plugin (native_exif: ^0.4.0).
From my side I can say that:
P.S. url = "http://65.108.239.148/verdeco/allegati/commesse/4107/223005/9_4107.jpg"
import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:path/path.dart' as path_instance;
Future<ExifLatLong?> getImageCoords(String url) async
{
// Get image from url
final response = await http.get(Uri.parse(url));
// Get the image name
final imageName = path_instance.basename(url);
// Get the document directory path
//final appDir = await path_provider.getApplicationDocumentsDirectory();
final appDir = await path_provider.getApplicationSupportDirectory();
// This is the saved image path
// You can use it to display the saved image later
final localPath = path_instance.join(appDir.path, imageName);
// Downloading
final imageFile = File(localPath);
await imageFile.writeAsBytes(response.bodyBytes);
// Extract exif
var exif = await Exif.fromPath(localPath);
var coords = await exif.getLatLong();
await exif.close();
await imageFile.delete();
return coords;
}
I want to set the altitude value, await exif.writeAttribute("key", "value"); I tried with but it didn't work
Hey guys,
Can we bump the version so we can align with intl 0.18?
Given:
Under More Info Section, Exif Tab is missing
While reading the EXIF data for the given Image, the Library throws the exception. i.e No Exif data was found on this image
PlatformException(READ_ERROR, No Exif data was found on this image., null, null)
I want to add custom info in User Comment key in exif data.
I see all relevant fields are private for the exif interface, NativeExifPlugin hasn't two tags is GPSImgDirection and GPSHPositioningError which is found in IOS. Please add them to NativeExifPlugin of Android that will help me collect more data of GPS. Thanks!
Hey! I've been trying to use the exif reader with video but having no luck.
I've tried with multiple mp4 files, and some mov files.
It works fine with images I've tested with. Is it for images only?
The error I get is:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(READ_ERROR, Error while reading metadata from source, null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2 Exif.getAttributes (package:native_exif/native_exif.dart:54:20)
Hi there,
await exif.writeAttribute("key", "value");
final key1 = await exif.getAttribute('key');
I can't get the value
Using a similar library in NodeJS I am able to set the X/Y resolution and the image width and height. I can't seem to make this work with this library.
Code below is from https://github.com/hMatoba/piexifjs
zeroth[piexif.ImageIFD.XResolution] = [300, 1];
zeroth[piexif.ImageIFD.YResolution] = [300, 1];
zeroth[piexif.ImageIFD.ImageWidth] = 5;
zeroth[piexif.ImageIFD.ImageHeight] = 7;
This is what im trying below, are my tag names wrong?
await exif.writeAttributes({
"ImageWidth": 5,
"ImageHeight": 7,
"PixelXDimension": [300, 1],
"PixelYDimension": [300, 1],
});
When I try to use the first command: final exif = await Exif.fromPath(picture!.path);
I get the following error:
E/flutter (10499): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method initPath on channel native_exif)
I have tried to run flutter clean and flutter pub get to no avail.
await exif!.getLatLong() retuning null value
Future<ExifLatLong?> getLatLong() async {
final attributes = await getAttributes();
if (attributes == null) return null;
final latitude = attributes['GPSLatitude'];
final latitudeRef = attributes['GPSLatitudeRef'];
final longitude = attributes['GPSLongitude'];
final longitudeRef = attributes['GPSLongitudeRef'];
if (latitude is! double || latitudeRef is! String || longitude is! double || longitudeRef is! String) {
return null;
}
return ExifLatLong(
latitude: latitude * (latitudeRef == 'S' ? -1 : 1),
longitude: longitude * (longitudeRef == 'W' ? -1 : 1),
);
}
This is coming in Android OS version - 14 device
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.