答案 0 :(得分:1)
答案 1 :(得分:1)
如果您使用的是Ubuntu,则可能已安装 ImageMagick ,并且套件中有一个名为identify
的程序。您可以在命令行的终端中运行以下命令,或者您可以运行Python子进程并获取其输出:
identify -verbose someImage.jpg
示例输出
Image: /Users/mark/Desktop/IMG_2326.JPG
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 3264x2448+0+0
Resolution: 72x72
Print size: 45.3333x34
Units: PixelsPerInch
Type: TrueColor
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Channel statistics:
Pixels: 7990272
Red:
min: 0 (0)
max: 255 (1)
mean: 139.125 (0.545587)
standard deviation: 62.0934 (0.243503)
kurtosis: -0.948773
skewness: -0.255567
entropy: 0.980761
Green:
min: 0 (0)
max: 255 (1)
mean: 129.827 (0.509124)
standard deviation: 63.4802 (0.248942)
kurtosis: -0.744472
skewness: -0.322559
entropy: 0.978628
Blue:
min: 0 (0)
max: 255 (1)
mean: 121.768 (0.477522)
standard deviation: 63.6425 (0.249578)
kurtosis: -1.14208
skewness: 0.0243162
entropy: 0.980614
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 130.24 (0.510744)
standard deviation: 63.4733 (0.248915)
kurtosis: -0.968273
skewness: -0.18575
entropy: 0.980001
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 3264x2448+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 96
Orientation: TopLeft
Properties:
date:create: 2017-05-31T13:53:16+01:00
date:modify: 2014-09-23T08:22:25+01:00
exif:ApertureValue: 4845/1918
exif:BrightnessValue: 6155/1061
exif:ColorSpace: 1
exif:ComponentsConfiguration: 1, 2, 3, 0
exif:DateTime: 2014:09:23 08:22:25
exif:DateTimeDigitized: 2014:09:23 08:22:25
exif:DateTimeOriginal: 2014:09:23 08:22:25
exif:ExifImageLength: 2448
exif:ExifImageWidth: 3264
exif:ExifOffset: 204
exif:ExifVersion: 48, 50, 50, 49
exif:ExposureMode: 0
exif:ExposureProgram: 2
exif:ExposureTime: 1/120
exif:Flash: 24
exif:FlashPixVersion: 48, 49, 48, 48
exif:FNumber: 12/5
exif:FocalLength: 103/25
exif:FocalLengthIn35mmFilm: 33
exif:GPSAltitude: 10003/299
exif:GPSAltitudeRef: 0
exif:GPSInfo: 946
exif:GPSLatitude: 51/1, 51/1, 347/100
exif:GPSLatitudeRef: N
exif:GPSLongitude: 2/1, 12/1, 1992/100
exif:GPSLongitudeRef: W
exif:GPSTimeStamp: 7/1, 22/1, 2456/100
exif:ISOSpeedRatings: 64
exif:Make: Apple
exif:MakerNote: 65, 112, 112, 108, 101, 32, 105, 79, 83, 0, 0, 1, 77, 77, 0, 6, 0, 1, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 0, 7, 0, 0, 0, 104, 0, 0, 0, 92, 0, 4, 0, 9, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0, 9, 0, 0, 0, 1, 0, 0, 0, 208, 0, 6, 0, 9, 0, 0, 0, 1, 0, 0, 0, 218, 0, 7, 0, 9, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 98, 112, 108, 105, 115, 116, 48, 48, 212, 1, 2, 3, 4, 5, 6, 7, 8, 89, 116, 105, 109, 101, 115, 99, 97, 108, 101, 85, 101, 112, 111, 99, 104, 85, 118, 97, 108, 117, 101, 85, 102, 108, 97, 103, 115, 18, 59, 154, 202, 0, 16, 0, 19, 0, 0, 18, 143, 64, 67, 109, 189, 16, 1, 8, 17, 27, 33, 39, 45, 50, 52, 61, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63
exif:MeteringMode: 5
exif:Model: iPhone 5
exif:Orientation: 1
exif:ResolutionUnit: 2
exif:SceneCaptureType: 0
exif:SceneType: 1
exif:SensingMethod: 2
exif:ShutterSpeedValue: 5567/806
exif:Software: 7.1.2
exif:SubjectArea: 1631, 1223, 1795, 1077
exif:SubSecTimeDigitized: 918
exif:SubSecTimeOriginal: 918
exif:thumbnail:Compression: 6
exif:thumbnail:JPEGInterchangeFormat: 1210
exif:thumbnail:JPEGInterchangeFormatLength: 12195
exif:thumbnail:ResolutionUnit: 2
exif:thumbnail:XResolution: 72/1
exif:thumbnail:YResolution: 72/1
exif:WhiteBalance: 0
exif:XResolution: 72/1
exif:YCbCrPositioning: 1
exif:YResolution: 72/1
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
signature: 84dc83ac4ff07920155036d321be9b8fe687be8b5eb68a76e20518b3e6f048f8
unknown: 103/25, 103/25, 12/5, 12/5
Profiles:
Profile-exif: 16380 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 3.9071MiB
Number pixels: 7.99027M
Pixels per second: 47.0016MB
User time: 0.150u
Elapsed time: 0:01.170
Version: ImageMagick 7.0.5-6 Q16 x86_64 2017-05-15 http://www.imagemagick.org
另一个选项是exiftool
,你可以在命令行中这样运行,也可以在Python中作为子进程运行:
exiftool ~/Desktop/IMG_2326.JPG
示例输出
ExifTool Version Number : 10.50
File Name : IMG_2326.JPG
Directory : /Users/mark/Desktop
File Size : 3.9 MB
File Modification Date/Time : 2014:09:23 08:22:25+01:00
File Access Date/Time : 2017:05:31 13:57:20+01:00
File Inode Change Date/Time : 2017:05:31 13:53:16+01:00
File Permissions : rw-------
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Big-endian (Motorola, MM)
Make : Apple
Camera Model Name : iPhone 5
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : 7.1.2
Modify Date : 2014:09:23 08:22:25
Y Cb Cr Positioning : Centered
Exposure Time : 1/120
F Number : 2.4
Exposure Program : Program AE
ISO : 64
Exif Version : 0221
Date/Time Original : 2014:09:23 08:22:25
Create Date : 2014:09:23 08:22:25
Components Configuration : Y, Cb, Cr, -
Shutter Speed Value : 1/120
Aperture Value : 2.4
Brightness Value : 5.801131008
Metering Mode : Multi-segment
Flash : Auto, Did not fire
Focal Length : 4.1 mm
Subject Area : 1631 1223 1795 1077
Run Time Scale : 1000000000
Run Time Epoch : 0
Run Time Value : 20406467784125
Run Time Flags : Valid
Sub Sec Time Original : 918
Sub Sec Time Digitized : 918
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 3264
Exif Image Height : 2448
Sensing Method : One-chip color area
Scene Type : Directly photographed
Exposure Mode : Auto
White Balance : Auto
Focal Length In 35mm Format : 33 mm
Scene Capture Type : Standard
Lens Info : 4.12mm f/2.4
Lens Make : Apple
Lens Model : iPhone 5 back camera 4.12mm f/2.4
GPS Latitude Ref : North
GPS Longitude Ref : West
GPS Altitude Ref : Above Sea Level
GPS Time Stamp : 07:22:24.56
Compression : JPEG (old-style)
Thumbnail Offset : 1222
Thumbnail Length : 12195
Image Width : 3264
Image Height : 2448
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Aperture : 2.4
GPS Altitude : 33.4 m Above Sea Level
GPS Latitude : 51 deg 51' 3.47" N
GPS Longitude : 2 deg 12' 19.92" W
GPS Position : 51 deg 51' 3.47" N, 2 deg 12' 19.92" W
Image Size : 3264x2448
Megapixels : 8.0
Run Time Since Power Up : 5:40:06
Scale Factor To 35 mm Equivalent: 8.0
Shutter Speed : 1/120
Create Date : 2014:09:23 08:22:25.918
Date/Time Original : 2014:09:23 08:22:25.918
Thumbnail Image : (Binary data 12195 bytes, use -b option to extract)
Circle Of Confusion : 0.004 mm
Field Of View : 57.2 deg
Focal Length : 4.1 mm (35 mm equivalent: 33.0 mm)
Hyperfocal Distance : 1.89 m
Light Value : 10.1
另一个选项exiv2
可从here获得,并且还提供各种库API。
我没有使用它,也不能认可它,但也有a Python interface to exiv2。
如果你想要一个Python子进程,你可以做这样的事情:
import subprocess
...
...
p = subprocess.Popen(['identify -verbose someImage.jpg'], stdout=subprocess.PIPE)
retcode = p.wait()
data = p.stdout.read()
答案 2 :(得分:-1)
使用Opencv,我们可以读取图像类型,宽度,高度,深度但我们无法读取与ISo,ShutterSpeed,亮度,描述和修改日期,创建相关的其他参数。 如果您想获得该信息,可以使用C#
获取