Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

NExif corrupting files when writing Keywords tag #20

Open
SimonKravis opened this issue Apr 11, 2023 · 1 comment
Open

NExif corrupting files when writing Keywords tag #20

SimonKravis opened this issue Apr 11, 2023 · 1 comment

Comments

@SimonKravis
Copy link

I am using Nexif from c# in a Visual Studio project to add keywords in the string array sTags to a file sFile and store the tagged file as sFile_7.tmp.jpg with the code below
` ///


/// Set sFile Keywords using NExifTool and write to sFile + _7.tmp.jpg
///

///
///
public async static void SetTagsWithNexif(string sFile, string[] sTags)
{
List UPDATE = new List {
new SetOperation(new NExifTool.Tag("keywords", sTags)) };

        var opts = new ExifToolOptions();
        var et = new ExifTool(opts);

        var result = await et.WriteTagsAsync(sFile, UPDATE, sFile+ "_7.tmp.jpg");
    }`

If I call this function several times, where sFile is a file previously captioned with the code, the output file sometimes contains part of the input image (usually the bottom, but placed at the top on the output image), but with the remainder filled with the same colour, which appears to be one of the colours appearing in the input image.

@AerisG222
Copy link
Owner

Hello, sorry for not getting back to you on this issue. I've been very busy and have not had a lot of time to look at this lib. I have not been able to replicate this so far, and will also be pushing a small update in the next day or two (I hope). That might be worth testing as it updates some underlying dependencies, but honestly would not expect that to address the issue.

I updated the "FileToFileWriteTest" locally to the following and have run a number of times w/o reproducing the issue:

        await et.WriteTagsAsync("file_to_file_test.jpg", UPDATES, "file_to_file_test2.jpg");
        await et.WriteTagsAsync("file_to_file_test.jpg", UPDATES, "file_to_file_test3.jpg");
        await et.WriteTagsAsync("file_to_file_test3.jpg", UPDATES, "file_to_file_test4.jpg");
        await et.WriteTagsAsync("file_to_file_test4.jpg", UPDATES, "file_to_file_test4.jpg");
        await et.WriteTagsAsync("file_to_file_test4.jpg", UPDATES, "file_to_file_test4.jpg");
        await et.WriteTagsAsync("file_to_file_test4.jpg", UPDATES, "file_to_file_test4.jpg");
        await et.WriteTagsAsync("file_to_file_test4.jpg", UPDATES, "file_to_file_test4.jpg");

I suspect this could be a difference between how windows and linux manages files, in particular around locking, but I don't have an easy way to test on win at the moment.

Were you able to work around this / get it to work?

Sorry for the lack of response,
Mike

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants