13

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!

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
Abdul Ahad
  • 2,187
  • 4
  • 24
  • 39
  • Please show your fine uploader configuration – Ray Nicholus Sep 26 '16 at 21:35
  • @RayNicholus - added in post above – Abdul Ahad Sep 26 '16 at 21:38
  • Fine Uploader definitely isn't at fault here. The file is not manipulated in any way before upload unless scaling is enabled (and that is not the case here). Something else must be causing your issue. My guess is that "tags" are not part of the image's EXIF/XMP data. Could be that this is stored outside of the actual file in Windows. – Ray Nicholus Sep 26 '16 at 21:59
  • @RayNicholus - Looks like I found the issue. There are some Icelandic character in tags. Thats making the problem. do you have any idea regarding this? – Abdul Ahad Sep 26 '16 at 22:07
  • No idea. I can tell you that fine uploader is not in involved though – Ray Nicholus Sep 26 '16 at 22:08
  • perhaps using utf8 http://perlmaven.com/image-exiftool-iptc-utf-8-support – arhak Nov 04 '16 at 01:00
  • 1
    Where does `Xmp` and `Iptc` came from ? Have you try a binary compare of both files ? – Cyril Durand Aug 01 '17 at 08:09
  • I think you can add encoding for support that letters. Something like this `Encoding.GetEncoding("iso-8859-1")` which is use when i read files which contains Icelandic characters – Ancient Aug 02 '17 at 19:14

1 Answers1

3

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.

John-Philip
  • 3,392
  • 2
  • 23
  • 52
  • In server-side just getting the stream and writing it to file as image. After further investigation found that, if those tags are added from `Adobe Photoshop Lightroom` then facing the issue. If we add the same tags from windows machine property window, it works fine. – Abdul Ahad Aug 03 '17 at 09:40
  • 1
    @AbdulAhad I edited my answer to cover this. You are probably trying to read tags in a format that was not used to store them. For instance `Windows machine` may store them in `XMP`, but `Adobe Photoshop Lightroom` may store them in `EXIF`. – John-Philip Aug 03 '17 at 10:01
  • 1
    Actually I have no idea about `Adobe Photoshop Lightroom`, but what you said might be a reason. I'll give it a try. – Abdul Ahad Aug 03 '17 at 10:09