Python

사진 이미지에서 속성값 추출하기

dkjeong 2022. 8. 17. 11:09
from exif import Image #exif 패키지 필요

file = "DJI_20220706153625_0586.JPG"
with open(file, "rb") as src:
    img = Image(src)

# img.list_all() #지원되는 모든 속성값 출력

for data in img.list_all():
    try: # 간혹 속성값 출력시 에러가 뜨는 속성이 있음. 아마도 print로 표현되지 않는 데이터 인듯)
        print(data, ":", img[data])
    except:
        continue

 

참고사이트: https://medium.com/spatial-data-science/how-to-extract-gps-coordinates-from-images-in-python-e66e542af354

 

image_description : default
make : DJI
model : ZenmuseP1
orientation : Orientation.TOP_LEFT
x_resolution : 72.0
y_resolution : 72.0
resolution_unit : ResolutionUnit.INCHES
software : 02.04.01.02
datetime : 2022:07:06 15:36:25
y_and_c_positioning : 2
_exif_ifd_pointer : 260
_gps_ifd_pointer : 722
xp_comment : 0.9.142
xp_keywords : singl
compression : 7
jpeg_interchange_format : 24994
jpeg_interchange_format_length : 7857
exposure_time : 0.001
f_number : 6.3
exposure_program : ExposureProgram.NORMAL_PROGRAM
photographic_sensitivity : 400
sensitivity_type : 2
exif_version : 0230
datetime_original : 2022:07:06 15:36:25
datetime_digitized : 2022:07:06 15:36:25
shutter_speed_value : 9.9658
aperture_value : 5.31
exposure_bias_value : 0.0
max_aperture_value : 2.97
metering_mode : MeteringMode.SPOT
light_source : LightSource.DAYLIGHT
flash : Flash(flash_fired=False, flash_return=FlashReturn.NO_STROBE_RETURN_DETECTION_FUNCTION, flash_mode=FlashMode.UNKNOWN, flash_function_not_present=False, red_eye_reduction_supported=False, reserved=0)
focal_length : 35.0
color_space : ColorSpace.SRGB
pixel_x_dimension : 8192
pixel_y_dimension : 5460
exposure_mode : ExposureMode.AUTO_EXPOSURE
white_balance : WhiteBalance.AUTO
digital_zoom_ratio : 1.0
focal_length_in_35mm_film : 35
scene_capture_type : SceneCaptureType.STANDARD
gain_control : 0
contrast : 0
saturation : Saturation.NORMAL
sharpness : Sharpness.NORMAL
body_serial_number : 3XMDJ5K0017780
lens_specification : (35.0, 35.0, 2.8, 2.8)
lens_serial_number : 01DY112G039P
gps_version_id : 2
gps_latitude_ref : N
gps_latitude : (37.0, 35.0, 1.6509)
gps_longitude_ref : E
gps_longitude : (126.0, 53.0, 43.3678)
gps_altitude_ref : GpsAltitudeRef.ABOVE_SEA_LEVEL
gps_altitude : 79.482
gps_status : A
gps_map_datum : WGS-84

'Python' 카테고리의 다른 글

string format  (0) 2022.05.25
os.*  (0) 2022.05.25