Saving jpg after watermark throwing exception

I’m using your sample code for watermarking images.

I trying to add a watermark to this jpeg file that I uploaded but there is an exception when I want to save the file.
Exception message: “Unable to find assembly 'Aspose.Imaging, Version=20.7.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56

I added a JpegOptions to the function and after that, the file was saved and watermarked successfully. The only problem was that is the processed file metadata was removed.

image.Save(outPath, new Aspose.Imaging.ImageOptions.JpegOptions());

The image metadata contains Hebrew text. Could it cause this problem?

sample_file.zip (1.2 MB)

Aspose.Imaging 20.7.0 version, .NETStandard 2.1 on .Net Core Runtime 1.8

The whole exception message:

System.Runtime.Serialization.SerializationException: Unable to find assembly ‘Aspose.Imaging, Version=20.7.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’.
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap…ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(BinaryParser serParser, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, Boolean check)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at .(Object )
at .()
at .Process(Rectangle , Byte[] , Point , Point)
at .Process(Rectangle , Int32[] , Point , Point)
at ​ .Process(Rectangle , Int32[] , Point , Point)
at .(Rectangle , IPartialArgb32PixelLoader )
at .(Rectangle , IPartialArgb32PixelLoader )
at …LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
at . (Rectangle )
at .( , IList1 , ) at .(Rectangle , , , Int32, Int32 , ) at .(Rectangle , , ) at .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader ) at . (Rectangle ) at .( , IList1 , )
at .(Rectangle , , , Int32, Int32 , )
at .(Rectangle , , )
at . (Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , JpegOptions , , Rectangle)
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , Stream , JFIFData , JpegExifData, XmpPacketWrapper , JpegOptions , Rectangle )
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.SaveData(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(String filePath)

Thanks,
Gabor

@erdeiga

I suggest you to please try using latest Aspose.Imaging 20.8 on your end. In case there is still an issue then please share the working sample visual studio project (not code snippet) reproducing the issue.

Hi @mudassir.fayyaz,
I updated to 20.8 but the exception still occurs.

System.Runtime.Serialization.SerializationException: Unable to find assembly ‘Aspose.Imaging, Version=20.8.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’.
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap…ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(BinaryParser serParser, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, Boolean check)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at .(Object )
at .()
at ​ .Process(Rectangle , Byte[] , Point , Point)
at .Process(Rectangle , Int32[] , Point , Point)
at .Process(Rectangle , Int32[] , Point , Point)
at .(Rectangle , IPartialArgb32PixelLoader )
at .(Rectangle , IPartialArgb32PixelLoader )
at …LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
at (Rectangle )
at . , IList1 , ) at .(Rectangle , , , Int32, Int32 , ) at .(Rectangle , , ) at .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader ) at (Rectangle ) at . , IList1 , )
at .(Rectangle , , , Int32, Int32 , )
at .(Rectangle , , )
at . (Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , JpegOptions , ​ , Rectangle)
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , Stream , JFIFData , JpegExifData, XmpPacketWrapper , JpegOptions , Rectangle )
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.SaveData(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(String filePath)

@erdeiga

Please provide the requested information along with source files for further investigation on our end.

1 Like

@mudassir.fayyaz

You can download the .Net project from this link.

The instructions in the README file.

@erdeiga

I have created an issue with ID IMAGINGNET-4143 in our issue tracking system based on the information provided. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as IMAGINGNET-4143) have been fixed in this update.