Skip to content

Extract exif-data from uploaded images#885

Open
gunnarvelle wants to merge 11 commits intomasterfrom
image-exif-data
Open

Extract exif-data from uploaded images#885
gunnarvelle wants to merge 11 commits intomasterfrom
image-exif-data

Conversation

@gunnarvelle
Copy link
Member

@gunnarvelle gunnarvelle commented Mar 5, 2026

Henter ut exif-data ved opplasting av bilde.

La til filtering slik at dei verste binære exif-dataene ikkje lagres. Utenom det så lagres alt av exif i databasen, men kun dato for når bildet blei tatt returneres til klient i denne omgangen. For bildet i kommentaren under vil det seie "Exif SubIFD:Date/Time Original": "2025:12:10 20:46:09"

@gunnarvelle
Copy link
Member Author

gunnarvelle commented Mar 5, 2026

Testa å laste opp bilde fra mobilen:

"exifData": {
        "JPEG:Component 3": "Quantization table 1, Sampling factors 1 horiz/1 vert",
        "Exif IFD0:Model": "Pixel 6",
        "Exif SubIFD:Sub-Sec Time Original": "589",
        "JPEG:Image Height": "4032",
        "Exif SubIFD:Time Zone Digitized": "+01:00",
        "Exif SubIFD:Subject Distance Range": "1",
        "Exif IFD0:Date/Time": "2025:12:10 20:46:09",
        "Exif SubIFD:Date/Time Original": "2025:12:10 20:46:09",
        "GPS:GPS Longitude": "9/1 53/1 4007/100",
        "JFIF:Thumbnail Width Pixels": "0",
        "GPS:GPS Altitude": "5359/100",
        "ICC Profile:Green TRC": "112 97 114 97 0 0 0 0 0 3 0 0 0 2 102 102 0 0 242 167 0 0 13 89 0 0 19 208 0 0 10 91",
        "Exif SubIFD:Sharpness": "0",
        "Exif SubIFD:Max Aperture Value": "1.78",
        "Exif SubIFD:Sub-Sec Time Digitized": "589",
        "Exif IFD0:Resolution Unit": "2",
        "Exif SubIFD:Exposure Program": "2",
        "GPS:GPS Latitude": "59/1 45/1 3404/100",
        "Exif Thumbnail:Thumbnail Length": "21000",
        "Exif SubIFD:Time Zone": "+01:00",
        "ICC Profile:Profile Copyright": "109 108 117 99 0 0 0 0 0 0 0 1 0 0 0 12 101 110 85 83 0 0 0 62 0 0 0 28 0 67 0 111 0 112 0 121 0 114 0 105 0 103 0 104 0 116 0 32 0 40 0 99 0 41 0 32 0 50 0 48 0 50 0 51 0 32 0 71 0 111 0 111 0 103 0 108 0 101 0 32 0 73 0 110 0 99 0 46 0 0",
        "JPEG:Component 2": "Quantization table 1, Sampling factors 1 horiz/1 vert",
        "Exif SubIFD:Lens Make": "Google",
        "JFIF:Thumbnail Height Pixels": "0",
        "GPS:GPS Longitude Ref": "E",
        "ICC Profile:Blue Colorant": "88 89 90 32 0 0 0 0 0 0 36 159 0 0 15 132 0 0 182 195",
        "Exif SubIFD:FlashPix Version": "48 49 48 48",
        "ICC Profile:Profile Size": "596",
        "File Type:Detected File Type Name": "JPEG",
        "File Type:Detected File Type Long Name": "Joint Photographic Experts Group",
        "GPS:GPS Time-Stamp": "19/1 45/1 56/1",
        "ICC Profile:Profile Connection Space": "XYZ ",
        "GPS:GPS Version ID": "2 2 0 0",
        "File Type:Detected MIME Type": "image/jpeg",
        "ICC Profile:Version": "67108864",
        "Exif IFD0:Y Resolution": "72",
        "Exif SubIFD:Exif Version": "48 50 51 50",
        "ICC Profile:Color space": "RGB ",
        "Exif SubIFD:Scene Type": "1",
        "Exif SubIFD:Sub-Sec Time": "589",
        "Exif IFD0:Make": "Google",
        "ICC Profile:Profile Description": "109 108 117 99 0 0 0 0 0 0 0 1 0 0 0 12 101 110 85 83 0 0 0 36 0 0 0 28 0 115 0 82 0 71 0 66 0 32 0 73 0 69 0 67 0 54 0 49 0 57 0 54 0 54 0 45 0 50 0 46 0 49 0 0",
        "Exif SubIFD:Sensing Method": "2",
        "Exif IFD0:YCbCr Positioning": "1",
        "GPS:GPS Altitude Ref": "0",
        "Exif SubIFD:Focal Length": "6.81",
        "JPEG:Number of Components": "3",
        "ICC Profile:Green Colorant": "88 89 90 32 0 0 0 0 0 0 98 151 0 0 183 135 0 0 24 217",
        "Exif IFD0:Orientation": "1",
        "Exif SubIFD:Time Zone Original": "+01:00",
        "Exif SubIFD:Saturation": "0",
        "Exif Thumbnail:Compression": "6",
        "Exif SubIFD:Components Configuration": "1 2 3 0",
        "GPS:GPS Date Stamp": "2025:12:10",
        "JFIF:X Resolution": "1",
        "JPEG:Compression Type": "0",
        "Interoperability:Interoperability Index": "R98",
        "Exif SubIFD:Custom Rendered": "1",
        "Exif IFD0:X Resolution": "72",
        "Huffman:Number of Tables": "4",
        "Exif SubIFD:Digital Zoom Ratio": "0",
        "JPEG:Image Width": "2268",
        "ICC Profile:Blue TRC": "112 97 114 97 0 0 0 0 0 3 0 0 0 2 102 102 0 0 242 167 0 0 13 89 0 0 19 208 0 0 10 91",
        "Exif SubIFD:Metering Mode": "2",
        "Exif SubIFD:Subject Distance": "531/1000",
        "Exif SubIFD:Exif Image Height": "4032",
        "Exif SubIFD:F-Number": "1.85",
        "GPS:GPS Img Direction": "116",
        "Exif SubIFD:Date/Time Digitized": "2025:12:10 20:46:09",
        "Interoperability:Interoperability Version": "48 49 48 48",
        "JFIF:Resolution Units": "0",
        "Exif SubIFD:Contrast": "0",
        "ICC Profile:Red Colorant": "88 89 90 32 0 0 0 0 0 0 111 160 0 0 56 245 0 0 3 144",
        "ICC Profile:Profile Date/Time": "2023:03:09 10:57:00",
        "Exif SubIFD:Color Space": "1",
        "Exif SubIFD:Aperture Value": "1.78",
        "ICC Profile:XYZ values": "0.964 1 0.825",
        "ICC Profile:Chromatic Adaptation": "115 102 51 50 0 0 0 0 0 1 12 66 0 0 5 222 255 255 243 39 0 0 7 147 0 0 253 144 255 255 251 163 255 255 253 164 0 0 3 220 0 0 192 110",
        "Exif SubIFD:Flash": "16",
        "JPEG:Component 1": "Quantization table 0, Sampling factors 2 horiz/2 vert",
        "JPEG:Data Precision": "8",
        "Exif SubIFD:Shutter Speed Value": "5.64",
        "Exif SubIFD:Brightness Value": "-11/100",
        "Exif SubIFD:Scene Capture Type": "0",
        "ICC Profile:Device manufacturer": "GOOG",
        "JFIF:Y Resolution": "1",
        "ICC Profile:Signature": "acsp",
        "Exif SubIFD:Focal Length 35": "24",
        "Exif Thumbnail:Y Resolution": "72",
        "Exif IFD0:Software": "HDR+ 1.0.821848803zd",
        "ICC Profile:Media White Point": "88 89 90 32 0 0 0 0 0 0 246 214 0 1 0 0 0 0 211 45",
        "Exif SubIFD:Lens Model": "Pixel 6 back camera 6.81mm f/1.85",
        "Exif SubIFD:White Balance Mode": "0",
        "ICC Profile:Media Black Point": "88 89 90 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
        "Exif SubIFD:ISO Speed Ratings": "579",
        "Exif Thumbnail:X Resolution": "72",
        "Exif Thumbnail:Resolution Unit": "2",
        "ICC Profile:Tag Count": "11",
        "GPS:GPS Img Direction Ref": "M",
        "Exif Thumbnail:Thumbnail Offset": "1283",
        "ICC Profile:Red TRC": "112 97 114 97 0 0 0 0 0 3 0 0 0 2 102 102 0 0 242 167 0 0 13 89 0 0 19 208 0 0 10 91",
        "Exif SubIFD:Exif Image Width": "2268",
        "Exif SubIFD:Exposure Mode": "0",
        "Exif SubIFD:Exposure Bias Value": "0",
        "Exif SubIFD:Exposure Time": "0.02",
        "ICC Profile:Class": "mntr",
        "JFIF:Version": "258",
        "GPS:GPS Latitude Ref": "N",
        "Exif Thumbnail:Orientation": "1",
        "File Type:Expected File Name Extension": "jpg",
        "XMP:XMP Value Count": "1"
}

Litt i overkant?

@gunnarvelle gunnarvelle force-pushed the image-exif-data branch 2 times, most recently from 18f2954 to 8202c47 Compare March 6, 2026 09:34
@gunnarvelle gunnarvelle requested a review from a team March 6, 2026 11:51
@gunnarvelle gunnarvelle marked this pull request as ready for review March 6, 2026 11:51
}

private def extractMetadataMap(metadata: ImageMetadata): Map[String, String] = {
metadata
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata er egentlig delt inn i directories, men her flates det ut til en endimensjonal map. Tenkte det var tilstrekkelig.

Copy link
Contributor

@jnatten jnatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hva er planen for å bruke dette?

@gunnarvelle
Copy link
Member Author

Hva er planen for å bruke dette?

I utgangspunktet kun for å hente ut dato for når bildet blei tatt. Men når eg først skulle lese exif-data kunne eg like gjerne hente ut alt som kan være nyttig på sikt.

@gunnarvelle gunnarvelle requested review from a team, amatho and jnatten March 11, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants