Closed ivanooi closed 6 years ago
@ivanooi Please send the image and code to me. I would like to do a test.
Hi ,
Sample code and image sent to your email yuwen_66@yahoo.com
Thanks again Ivan
@ivanooi I tested with your image and code and I can see that icafe read XMP information perfectly. What made you think icafe failed to read XMP?
Oh! That Great! Is it some things wrong with code ?
fin = new FileInputStream("test.JPG");//20171209_214631
Map<MetadataType, Metadata> metadataMap = Metadata.readMetadata( fin );
int i = 0;
for(Map.Entry<MetadataType, Metadata> entry : metadataMap.entrySet()) {
System.out.println( i + "=" + entry.getKey());
entry.getValue().showMetadata();
i++;
}
XMP xmp = (XMP)metadataMap.get(MetadataType.XMP);
XMP jpegXmp = null;
if( xmp != null ){
Document xmpDoc = xmp.getMergedDocument();
System.out.println("xmp");
System.out.println(xmp.getXmpDocument().getTextContent());
System.out.println();
System.out.println();
System.out.println("xmpDoc");
System.out.println(xmpDoc.getDocumentURI());
jpegXmp = new JpegXMP(XMLUtils.serializeToByteArray(xmpDoc));
// Metadata.insertXMP(fin, fout, jpegXmp);
}
Hi.
Is it I need the latest source? If I used the pre-compiled jar files. This is the result I get :
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 0=EXIF 1=XMP 2=IMAGE xmp null
xmpDoc null
@ivanooi You need to include a few libraries including the logging library which is SLF4J along with icafe.jar to make it work properly.
The null output from your comment is not a big deal as that happens to DOM document model. Although it shows null, there is actually nothing wrong. The final result will be fine.
I tested with your code, it is working fine. I am not sure why you commented out the last line which actually does the insertion of XMP to the target image and I also didn't see the "fout" defined.
Hi ,
Thanks for your help. You are right! I managed to grab the XML using the XMLUtils . I commentted that out as just wanted to test only. I will post the few statements here.
Yape ! Thanks alot ! It work as advertise 😂 I'm switching from Apache library to iCafe now
Hi ,
I got an example image which contained XMP data but iCafe failed to read it. Or i miss some things ?
Anyway i can send you the sample code and image ?
Thanks