Obtain the various parameter information of the picture Check the picture retouching software used

Picture parameters

Overview

Sometimes, for a picture, it is not enough to only see the image presented by it. This requires obtaining other relevant information about the picture. Two methods are shared here.

Suppose one day a netizen sends you a selfie, saying that it is his selfie, and after meeting you find that the picture and the real person are two people, is it a thief? Recommend a software to avoid "spoofing". The official account replied "JPEG" to get the software.

1. The software obtains the retouching information of the picture

Click to run the software, and then you can see the basic information of the opened image. What is useful to us is generally the basic parameters and whether it has been processed, which can be seen in this software.
Obtain the various parameter information of the picture Check the picture retouching software used

Since my picture has been optimized and processed by the AI ​​that comes with the phone, the final rating result is "The processed may be very large." The picture below was processed by Photoshop, and he automatically recognized that it was processed by Photoshop.
Obtain the various parameter information of the picture Check the picture retouching software used

Obtain the various parameter information of the picture Check the picture retouching software used

2.Python reads picture information

Because I need to use part of the picture's parameter information in image processing, I can't read it with this software every time, and then copy it into the project. Therefore, I checked some materials and learned that the exifread module can be used to obtain the exif information of the picture, and I wrote a little code to read the picture information for engineering. Only the latitude and longitude of the picture and the shooting time are output here (I finally thought of a question that a friend asked me before: can I know if a picture was taken today, so I added a few sentences about whether the shooting time is today’s statement) The code is as follows


import exifread
import datetime

# 使用 exifread 获取图片的元数据
img_exif = exifread.process_file(open('D:/图片/MyPhone/IMG_20191020_194207R.jpg', 'rb'))

# 能够读取到属性
if img_exif:
    # 纬度数
    latitude_gps = img_exif['GPS GPSLatitude']

    # N,S 南北纬方向
    latitude_direction = img_exif['GPS GPSLatitudeRef']

    # 经度数
    longitude_gps = img_exif['GPS GPSLongitude']

    # E,W 东西经方向
    longitude_direction = img_exif['GPS GPSLongitudeRef']

    # 拍摄时间
    take_time = img_exif['EXIF DateTimeOriginal']

    print(latitude_gps, latitude_direction, longitude_gps, longitude_direction, take_time)

    # 判断拍摄时间是否是在今天
    # 拍摄时间
    format_time = str(take_time).split(" ")[0].replace(":", "-")

    # 当天日期
    today = str(datetime.date.today())

    if format_time == today:
        print("该图片是今天拍摄")
    else:
        print("该图片不是今天拍摄")

else:
    print("该图片已经处理过,无法获取图片信息")

Here I only output a part of the parameters that are useful to me. For specific parameters, you can query the Key output by yourself.

Obtain the various parameter information of the picture Check the picture retouching software used

Guess you like

Origin blog.51cto.com/15069472/2577321