Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net - image keywords missing after uploading image to server

I'm uploading image to server and then processing the image. Funny thing is, after uploading the image image keywords are missing. Although other image properties are there.

enter image description here

There is no issue with parsing the tags, so please ignore below code snippet.

using (var xmp = Xmp.FromFile(workingFilePath, XmpFileMode.ReadOnly))
{
    var iptc = new Iptc(xmp);
    var Keywords = iptc.Keywords;
}

Note: I'm using FineUploader to upload image.

FineUploader configuration -

var manualUploader = new qq.FineUploader({
    element: document.getElementById('fine-uploader-manual-trigger'),
    template: 'qq-template-manual-trigger',
    request: {
        endpoint: '/image/uploadimage',
        params: {
            datestamp: datetimeStamp
        }
    },
    callbacks: {
    },
    autoUpload: false,
    multiple: true
});

qq(document.getElementById("trigger-upload")).attach("click", function () {
    manualUploader.uploadStoredFiles();
});

Fineuploader log -

 [Fine Uploader 5.10.1] Received 1 files.
 [Fine Uploader 5.10.1] Attempting to validate image.
 [Fine Uploader 5.10.1] Generating new thumbnail for 0
 [Fine Uploader 5.10.1] Attempting to draw client-side image preview.
 [Fine Uploader 5.10.1] Attempting to determine if _DSE8404.jpg can be rendered in this browser
 [Fine Uploader 5.10.1] First pass: check type attribute of blob object.
 [Fine Uploader 5.10.1] Second pass: check for magic bytes in file header.
 [Fine Uploader 5.10.1] '_DSE8404.jpg' is  able to be rendered in this browser
 [Fine Uploader 5.10.1] Moving forward with EXIF header parsing for '_DSE8404.jpg'
 [Fine Uploader 5.10.1] EXIF Byte order is little endian
 [Fine Uploader 5.10.1] Found 10 APP1 directory entries
 [Fine Uploader 5.10.1] Successfully parsed some EXIF tags
 [Fine Uploader 5.10.1] Sending simple upload request for 0
 [Fine Uploader 5.10.1] xhr - server response received for 0

Edit : Looks like I found the issue. There are some Icelandic character in tags. Thats making the problem. Anyone know how to solve this!

Latest Edit If those tags have been added from Adobe Photoshop Lightroom then facing the issue. But if the same tags are added from windows machine by updating properties, it works!

like image 282
Abdul Ahad Avatar asked Sep 26 '16 21:09

Abdul Ahad


1 Answers

There could be two causes of your problem :

  1. At some point you are rewriting your picture, probably with a class that either does not properly handle tags or strip them out because of its configuration.
    If you just save the exact binary content you receive from the client you will also retrieve your original tags, provided your image file is formatted the way you expect it to be.

  2. If your image file is stored differently from what you expect, the tags may not be retrieved depending on the way you are extracting them.
    For instance, JPG/JPEG tags can be stored in various manner (XMP beeing one). Check the following link for more details. You will see there are other way to store tags (such as EXIF, Extended XMP, QVCI, FLIR).
    To retrieve these tags you will have to parse them according to the way they are embedded in your image file.
    From the server-side code you posted, you only seems to parse XMP tags. Depending on the software used to encode the original image, tags may be stored in an alternative format.

Although it look obvious, my advise would be :

  1. to ensure that your workflow does not involve any explicit or implicit image manipulation between the content sent by the client to the content saved on the server.
  2. That being said you will also have to ensure you are extracting tags with an appropriate way, depending on their format.

JPEG files can be really difficult to handle properly because of the various ways they may be stored.

like image 184
John-Philip Avatar answered Nov 03 '22 02:11

John-Philip