copy metadata from raw to jpg failed.
ivanooi opened this issue · 1 comments
Hi,
from my test. I'm able to read the metadata from raw file but it failed to write it into jpg file.
There;s no error. but when I check the metadata. XMP and Exif missing.
thanks
sample jpg and raw file
https://drive.google.com/file/d/1sK7f_-rZd4-IVlrHVj8086kVPb33OE-d/view?usp=sharing
`
Map<MetadataType, Metadata> metadataMap ;
try {
List<Metadata> metaList = new ArrayList<Metadata>();
metadataMap = Metadata.readMetadata( src );
for (Map.Entry<MetadataType, Metadata> entry : metadataMap.entrySet()) {
System.out.println("metaList="+metaList.add( entry.getValue()));
System.out.println(entry.getValue().getType().name());
}
// System.out.println( des.getAbsoluteFile().getParent());
File lf_new = new File( des.getAbsoluteFile().getParentFile().getAbsolutePath() + "/" + des.getName() + ".new");
// File lf_temp = new File( des.getAbsoluteFile().getParentFile().getAbsolutePath() + "/" + des.getName() + ".TMP");
// if( des.renameTo( lf_temp ) == false ){
// return "rename failed";
// }
FileInputStream fin = new FileInputStream( des );
FileOutputStream fout= new FileOutputStream( lf_new );
// FileInputStream fin = new FileInputStream( lf_temp );
// FileOutputStream fout= new FileOutputStream( des );
Metadata.insertMetadata( metaList, fin, fout );
fin.close();
fout.close();
// lf_temp.delete();
} catch (IOException e) {
e.printStackTrace();
return e.toString();
}
`
ok. I had solved the issues. thanks :-D.
Exif exif2 = new JpegExif();
exif2.setExifIFD( orifinalExif1.getExifIFD());