ropensci / magick

Magic, madness, heaven, sin
https://docs.ropensci.org/magick
Other
462 stars 65 forks source link

dng pitcure to jpg #390

Open salder opened 10 months ago

salder commented 10 months ago

Hi, I need to convert dng files to jpg including all exif information most important the coordinates and time. when using image_convert() an jpg image is produced and saved, but the exif information is still the same: e.g. image_attributes(img.dng) property value 1 date:create 2024-01-09T14:49:06+00:00 after image convert: im property value 1 date:create 2024-01-09T14:49:06+00:00s(img.jpg) it is still the same but it should be like this: date:timestamp | 2024-01-10T09:07:14+00:00 let me know if you nedd som files some example!

Best regards Sven Adler

jeroen commented 10 months ago

Can you please include an example image url and format the code we need to run in ```r such that we can easily reproduce the exact problem ?

salder commented 10 months ago

I will send the images via mail!

library(magick)
dng.path<-"...../DJI_0468.DNG"
img <- image_read(dng.path,strip = FALSE)
image_attributes(img)
# property                     value
# 1                      date:create 2024-01-09T15:37:11+00:00
# 2                      date:modify 2024-01-09T15:37:16+00:00
# 3                   date:timestamp 2024-01-10T18:24:33+00:00
# 4            dng:camera.model.name                   L1D-20c
# 5                  dng:create.date 2023-08-14T09:12:01+00:00
# 6                dng:exposure.time                     1/100
# 7                     dng:f.number                         4
# 8                 dng:focal.length                  1e+01 mm
# 9  dng:focal.length.in.35mm.format                     28 mm
# 10                dng:gps.altitude                   8e+02 m
# 11                dng:gps.latitude        7e+01 deg 5' 16" N
# 12               dng:gps.longitude    2e+01 deg 2e+01' 18" W
# 13                 dng:iso.setting                     1e+02
# 14                        dng:lens               0-0mm f/0-0
# 15                dng:lens.f.stops                      0.00
# 16                   dng:lens.type                          
# 17                        dng:make                Hasselblad
# 18   dng:max.aperture.at.max.focal                         0
# 19   dng:max.aperture.at.min.focal                         0
# 20          dng:max.aperture.value                         3
# 21            dng:max.focal.length                      0 mm
# 22            dng:min.focal.length                    0.0 mm
# 23               dng:serial.number            0K8THCE0120186
# 24                    dng:software               10.00.14.05
# 25                dng:wb.rb.levels       2.89844 1.83594 1 0
image_convert(img,format = "jpeg")->img_jpg
image_attributes(img_jpg)
#the same as above
#the image attributes av en jpg file should look like this
jpg.path<-"L:/drönare i branter/klimpfjall/DJI_0001.jpg"
img <- image_read(jpg.path,strip = FALSE)
image_attributes(img)

#the img_jpg enfolds not the right propertys which makes it not readable from other programs.
#a function that makes it possible to define the atributes might be a simple resolution, set_attributes?