Hello,
We investigated a JPEG document info failure involving an XMP packet containing an empty <rdf:RDF/> element. These are typically found to be files created with a phone camera.
The affected JPEGs display correctly in image viewers, but GroupDocs fails during GetDocumentInfo() with:
GroupDocs.Conversion.Exceptions.CorruptOrDamagedFileException:
Cannot convert. The file is corrupt or damaged. Image loading failed.
Inner exception: Aspose.Imaging.CoreExceptions.ImageLoadException
Root exception: System.NullReferenceException
Object reference not set to an instance of an object.
Version comparison
Testing the same synthetic JPEG bytes produced these results:
| GroupDocs.Conversion for .NET | Result |
|---|---|
| 26.6.0 | Successful conversion |
| 26.7.0 | Fails |
| 26.8.0 | Fails |
| 26.10.0 | Fails |
The failing JPEG contains a standard XMP APP1 packet with an empty RDF container:
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
</x:xmpmeta>
A matching control image converts successfully when the RDF contains an empty Description:
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""/>
</rdf:RDF>
</x:xmpmeta>
Investigation findings
- Removing only the empty XMP APP1 packet allows conversion to succeed, without re-encoding or changing the remaining JPEG bytes.
- An empty
<rdf:Description/>succeeds despite containing no metadata properties, suggesting the failure relates to the missing Description element rather than the absence of property values.
Reproduction
I tried uploading a JPEG with an empty RDF, but it did not like that I also uploaded a JPEG that works - every time I try to upload the empty RDF file it shows and downloads as the working JPEG. So I have removed the attachments.
using GroupDocs.Conversion;
using GroupDocs.Conversion.Options.Convert;
using var converter =
new Converter("empty-rdf.jpg");
// Throws CorruptOrDamagedFileException with an underlying NullReferenceException.
converter.GetDocumentInfo();
converter.Convert("output.pdf", new PdfConvertOptions());