Voici un bout de code expliqué pour l'ajout des images HD non géré aussi
par le standard EXIF de Android


Create a new instance of ExifInterfaceExtended, passing the original source
image:



*import it.sephiroth.android.library.media.ExifInterfaceExtended;*

*...*


 *ExifInterfaceExtended originalExif = new ExifInterfaceExtended( srcPath
);*


 Copy the original exif tags into a temporary Bundle object:



*Bundle out = new Bundle();*

*originalExif.copyTo(out);*


When the hi-res process is complete, create a new ExifInterfaceExtended
instance passing the path of the just created image:



*newExif = new ExifInterfaceExtended( dstPath );*


Copy the temporary bundle object back to the new exif instance:



*// remember the current image width an height*

*int imageWidth = newExif.getAttributeInt(
ExifInterfaceExtended.TAG_EXIF_IMAGE_WIDTH, 0 );*

*int imageLength = newExif.getAttributeInt(
ExifInterfaceExtended.TAG_EXIF_IMAGE_LENGTH, 0 );*



*// This method will copy all the attributes of the *

*// original EXIF into the new EXIF instance*

*newExif.copyFrom( out, true );*



*// restore the correct tags*

*newExif.setAttribute( ExifInterfaceExtended.TAG_EXIF_IMAGE_WIDTH,
String.valueOf( imageWidth ) );*

*newExif.setAttribute( ExifInterfaceExtended.TAG_EXIF_IMAGE_LENGTH,
String.valueOf( imageLength ) );*



*// the editor already auto rotate the image pixels*

*newExif.setAttribute( ExifInterfaceExtended.TAG_EXIF_ORIENTATION, "0" );*





*// let's update the software tag too*

*newExif.setAttribute( ExifInterfaceExtended.TAG_EXIF_SOFTWARE,
"TonSoftEstCool" );*





*// update the datetime*

*newExif.setAttribute( ExifInterfaceExtended.TAG_EXIF_DATETIME,
ExifInterfaceExtended.getExifFormattedDate( new Date() ) );*



 Save the new exif tags:



*try {*

*    newExif.saveAttributes();*

*} catch ( IOException e ) {*

*    e.printStackTrace();*

*}*



Voilà voilà! Donc je pense qu'on peut facilement charger une image en exif
étendu ou directement prendre une photo dans n'importe quel API et ajouter
les information provenant de la boussole.


Jérôme

Le 2 octobre 2014 17:36, Jérôme Seigneuret <jseigneuret-...@yahoo.fr> a
écrit :

> Donc Android ne respecte pas les spec de l'exif 2.
>
> Il faut donc se baser sur cette librairie:
>
> https://github.com/sephiroth74/Android-Exif-Extended/tree/master/library/src/main/java/it/sephiroth/android/library/exif2
>
> Voir les lignes 735 et 736 dans
>
> https://github.com/sephiroth74/Android-Exif-Extended/blob/master/library/src/main/java/it/sephiroth/android/library/exif2/ExifInterface.java
>
> Donc à proposer au dev de surcharger la class ExifInterface avec les
> paramètres du standard 2.3 ou d'embarquer cette librairie dans leur code.
>
> Jérôme
>
> Le 2 octobre 2014 16:02, Stéphane Péneau <stephane.pen...@wanadoo.fr> a
> écrit :
>
> Le jeudi 2 octobre 2014 15:37:17, Jérôme Seigneuret a écrit :
>>
>>> Cela peut venir de la version du format exploité et du format de
>>> stockage (type d'image). Je ne sais pas quand le GPS à été intégré
>>> dans le spéc j'ai vu ça dans l'exif 2.2 er 2.3
>>>
>>
>> A priori ça vient plutôt de l'Api android qui limite les champs exif qui
>> peuvent être écrits :
>> http://developer.android.com/reference/android/media/ExifInterface.html
>> http://stackoverflow.com/questions/8051491/how-to-
>> apply-additional-exif-fields-to-jpegs-in-android
>>
>> Stf
>>
>>
>> _______________________________________________
>> Talk-fr mailing list
>> Talk-fr@openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/talk-fr
>>
>
>
_______________________________________________
Talk-fr mailing list
Talk-fr@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-fr

Répondre à