Corrupted Tif file after UpdateXmpMetadataMediaAction

I uploaded a tif file and downloaded using UpdateXmpMetadataMediaAction. The action is success but the file is corrupted. I tried with aspose.imaging versions 22.8, 22.9 and latest 22.10 but still the file is corrupted. I can send you the image but it cannot attach tif file here. Please check. Thank you.

@asiman please provide for us code that you use to reproduce and file. You can try attach file in zipped archive in post or upload to file service like dropbox, google drive, one drive etc. (4.8 MB)
Attached are the tif files. Filename original is the uploaded tif file and filename corrupted is the downloaded after UpdateXmpMetadataAction.

@asiman also please provide for us code that you use to reproduce issue. (2.1 KB)
Here’s the code

To add, the file is corrupted when UpdateXmpMetada

foreach (var mapping in xmpMapping.Descendants(“xmpMapping”).Elements(“add”))
// Get values from xmp metadata mapping
var xmpNamespace = mapping.Attribute(“namespace”).Value;
var xmpName = mapping.Attribute(“name”).Value;
var xmpPrefix = mapping.Attribute(“prefix”).Value;
var xmpValue = mapping.Value;

                    if (xmpData.ContainsPackage(xmpNamespace))
                        // Xmp namespace exists
                        foreach (var xmpPackage in xmpData.Packages)
                            if (xmpPackage.NamespaceUri.Trim().ToLower() == xmpNamespace.Trim())
                                if (xmpPackage.ContainsKey(xmpPackage.Prefix + ":" + xmpName))
                                    // Update xmp value if the property exists
                                    xmpPackage[(xmpPackage.Prefix + ":" + xmpName)] = xmpValue;
                                    // Create new property if it not exists
                                    xmpPackage.AddValue(xmpPackage.Prefix + ":" + xmpName, xmpValue);

                        // Create xmp namespace and xmp property if namespace not exists
                        XmpBasicPackage xmp = new XmpBasicPackage(xmpPrefix, xmpNamespace);
                        xmp.AddValue(xmpPrefix + ":" + xmpName, xmpValue);

@asiman, we have reviewed your code and looks your xmp commands are typical and does not contain errors (we don’t have your value of action.XmpMetadataMapping). And we found that issue reported by you is not related to xmp, but presented tiff image is saved wrongly. To avoid this you can try save in another color mode, for example: tiff.Save(@“result.tif”, new TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffDeflateRgb)); Related to this bug we prepared ticket to fix it - IMAGINGNET-5875

@samer.el-khatib4aspose This is the XmpMetadataMapping we used:

  <add namespace="" prefix="dc" name="description"><![CDATA[
<ref:text out="&lt;rdf:Alt xmlns:rdf=&quot;;&gt;"/>
<ref:text out="&lt;rdf:li xml:lang=&quot;x-default&quot;&gt;"/>
<ref:record fieldName="EmbeddedDescription" out="value"/>
<ref:text out="&lt;/rdf:li&gt;&lt;rdf:Alt&gt;"/>

The original tif file provided by customer is in CMYK color mode that’s why we are not saving it as Rgb color mode. We also tried creating a tif file with RGB color mode and it is working.
For the ticket IMAGINGNET-5875 you provided, is this will fix the tif file with non RGB color mode (e.g. CMYK)? As I need to inform the solution for this bug.

@asiman, in IMAGINGNET-5875 we are going to investigate and fix issue with provided file, exactly we don’t know what it will require from us.

@samer.el-khatib4aspose May I ask what is the current status for this bug fix task IMAGINGNET-5875 is? This is a problem for our customers that we would like to resolve which not changing the original color mode. Thanks

@asiman This issue is not fixed yet, it is in the queue. You will be notified on completion.

Hello, any update of this issue? Thanks

@asiman this issue is planned to be included in the 23.3 release.

Thanks. Please let me know once the 23.3 release is done.

@asiman You will be notified on completion.

1 Like

Noticed the status of this ticket is already closed. May I know when would be the 23.3 will be release? Thanks

@asiman, release 23.3 planned by end of the month.

The issues you have found earlier (filed as IMAGINGNET-5875) have been fixed in this update. This message was posted using Bugs notification tool by samer.el-khatib