asp.net - image keywords missing after uploading image to server
Asked Answered
B

1

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!

Bilodeau answered 26/9, 2016 at 21:25 Comment(8)
Please show your fine uploader configurationIceberg
@RayNicholus - added in post aboveBilodeau
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.Iceberg
@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?Bilodeau
No idea. I can tell you that fine uploader is not in involved thoughIceberg
perhaps using utf8 perlmaven.com/image-exiftool-iptc-utf-8-supportCure
Where does Xmp and Iptc came from ? Have you try a binary compare of both files ?Prank
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 charactersDefazio
C
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.

Coralline answered 3/8, 2017 at 9:33 Comment(3)
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.Bilodeau
@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.Coralline
Actually I have no idea about Adobe Photoshop Lightroom, but what you said might be a reason. I'll give it a try.Bilodeau

© 2022 - 2024 — McMap. All rights reserved.