使用exiftool从CR2图像中提取缩略图

约翰特

我试图exiftool在Windows中使用从CR2图像中提取JPEG缩略图

使用程序QuickJPGFromCR2,我成功地做到了。根据描述,似乎是从EXIF数据中提取JPEG预览。生成的文件的宽度和高度与原始图像相同,对于我正在使用的文件,其宽度在1〜2 MB之间。

首先,的输出exiftool .\Kendall_FACS_0002_0100A.cr2如下:

ExifTool Version Number         : 10.45
File Name                       : Kendall_FACS_0002_0100A.cr2
Directory                       : .
File Size                       : 25 MB
File Modification Date/Time     : 2016:10:20 14:47:47-05:00
File Access Date/Time           : 2016:11:21 18:26:10-06:00
File Creation Date/Time         : 2017:01:23 14:14:05-06:00
File Permissions                : rw-rw-rw-
File Type                       : CR2
File Type Extension             : cr2
MIME Type                       : image/x-canon-cr2
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 5184
Image Height                    : 3456
Bits Per Sample                 : 8 8 8
Compression                     : JPEG (old-style)
Make                            : Canon
Camera Model Name               : Canon EOS REBEL T3i
Preview Image Start             : 68120
Orientation                     : Horizontal (normal)
Preview Image Length            : 1708300
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Modify Date                     : 2016:10:20 14:46:19
Artist                          : 
Rating                          : 0
Copyright                       : 
Exposure Time                   : 1/100
F Number                        : 16.0
Exposure Program                : Manual
ISO                             : 100
Sensitivity Type                : Recommended Exposure Index
Recommended Exposure Index      : 100
Exif Version                    : 0230
Date/Time Original              : 2016:10:20 14:46:19
Create Date                     : 2016:10:20 14:46:19
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/99
Aperture Value                  : 16.0
Flash                           : Off, Did not fire
Focal Length                    : 40.0 mm
Macro Mode                      : Normal
Self Timer                      : Off
Quality                         : RAW
Canon Flash Mode                : Off
Continuous Drive                : Single
Focus Mode                      : Manual Focus (3)
Record Mode                     : CR2
Canon Image Size                : n/a
Easy Mode                       : Manual
Digital Zoom                    : None
Contrast                        : Normal
Saturation                      : Normal
Metering Mode                   : Evaluative
Focus Range                     : Not Known
Canon Exposure Mode             : Manual
Lens Type                       : Canon EF 40mm f/2.8 STM
Max Focal Length                : 40 mm
Min Focal Length                : 40 mm
Focal Units                     : 1/mm
Max Aperture                    : 2.8
Min Aperture                    : 23
Flash Activity                  : 0
Flash Bits                      : (none)
Zoom Source Width               : 0
Zoom Target Width               : 0
Manual Flash Output             : n/a
Color Tone                      : Normal
SRAW Quality                    : n/a
Auto ISO                        : 100
Base ISO                        : 100
Measured EV                     : 6.00
Target Aperture                 : 16
Target Exposure Time            : 1/102
Exposure Compensation           : 0
White Balance                   : Daylight
Slow Shutter                    : None
Shot Number In Continuous Burst : 0
Optical Zoom Code               : n/a
Camera Temperature              : 30 C
Flash Guide Number              : 0
Flash Exposure Compensation     : 0
Auto Exposure Bracketing        : Off
AEB Bracket Value               : 0
Control Mode                    : Camera Local Control
Measured EV 2                   : 6.625
Bulb Duration                   : 0
Camera Type                     : EOS High-end
ND Filter                       : n/a
Canon Image Type                : Canon EOS REBEL T3i
Canon Firmware Version          : Firmware Version 1.0.2
Flash Metering Mode             : Off
Camera Orientation              : Horizontal (normal)
Firmware Version                : 1.0.2
File Index                      : 2
Directory Index                 : 100
Contrast Standard               : 0
Sharpness Standard              : 3
Saturation Standard             : 0
Color Tone Standard             : 0
Contrast Portrait               : 0
Sharpness Portrait              : 2
Saturation Portrait             : 0
Color Tone Portrait             : 0
Contrast Landscape              : 0
Sharpness Landscape             : 4
Saturation Landscape            : 0
Color Tone Landscape            : 0
Contrast Neutral                : 0
Sharpness Neutral               : 0
Saturation Neutral              : 0
Color Tone Neutral              : 0
Contrast Faithful               : 0
Sharpness Faithful              : 0
Saturation Faithful             : 0
Color Tone Faithful             : 0
Contrast Monochrome             : 0
Sharpness Monochrome            : 3
Filter Effect Monochrome        : None
Toning Effect Monochrome        : None
Contrast Auto                   : 0
Sharpness Auto                  : 3
Saturation Auto                 : 0
Color Tone Auto                 : 0
Filter Effect Auto              : n/a
Toning Effect Auto              : n/a
Contrast User Def 1             : 0
Sharpness User Def 1            : 3
Saturation User Def 1           : 0
Color Tone User Def 1           : 0
Filter Effect User Def 1        : None
Toning Effect User Def 1        : None
Contrast User Def 2             : 0
Sharpness User Def 2            : 3
Saturation User Def 2           : 0
Color Tone User Def 2           : 0
Filter Effect User Def 2        : None
Toning Effect User Def 2        : None
Contrast User Def 3             : 0
Sharpness User Def 3            : 3
Saturation User Def 3           : 0
Color Tone User Def 3           : 0
Filter Effect User Def 3        : None
Toning Effect User Def 3        : None
User Def 1 Picture Style        : Auto
User Def 2 Picture Style        : Auto
User Def 3 Picture Style        : Auto
Canon Model ID                  : EOS Rebel T3i / 600D / Kiss X5
Thumbnail Image Valid Area      : 0 159 7 112
AF Area Mode                    : Off (Manual Focus)
Num AF Points                   : 9
Valid AF Points                 : 9
Canon Image Width               : 5184
Canon Image Height              : 3456
AF Image Width                  : 5184
AF Image Height                 : 3456
AF Area Widths                  : 139 139 139 196 238 196 139 139 139
AF Area Heights                 : 186 186 186 127 231 127 186 186 186
AF Area X Positions             : -1477 -886 -886 0 0 0 886 886 1477
AF Area Y Positions             : 0 418 -418 787 0 -787 418 -418 0
AF Points In Focus              : (none)
AF Points Selected              : 0,1,2,3,4,5,6,7,8
Original Decision Data Offset   : 0
Bracket Mode                    : Off
Bracket Value                   : 0
Bracket Shot Number             : 0
Raw Jpg Size                    : Large
Long Exposure Noise Reduction 2 : Off
WB Bracket Mode                 : Off
WB Bracket Value AB             : 0
WB Bracket Value GM             : 0
Live View Shooting              : Off
Focus Distance Upper            : 2.16 m
Focus Distance Lower            : 1.46 m
Flash Exposure Lock             : Off
Internal Serial Number          : ZC1954285
Dust Removal Data               : (Binary data 1024 bytes, use -b option to extract)
Crop Left Margin                : 0
Crop Right Margin               : 0
Crop Top Margin                 : 0
Crop Bottom Margin              : 0
Exposure Level Increments       : 1/3 Stop
ISO Expansion                   : Off
Flash Sync Speed Av             : Auto
Long Exposure Noise Reduction   : Off
High ISO Noise Reduction        : Standard
Highlight Tone Priority         : Disable
AF Assist Beam                  : Does not emit
Mirror Lockup                   : Enable
Shutter-AE Lock                 : AF/AE lock
Set Button When Shooting        : Normal (disabled)
LCD Display At Power On         : Display
Add Original Decision Data      : Off
Aspect Ratio                    : 3:2
Cropped Image Width             : 5184
Cropped Image Height            : 3456
Cropped Image Left              : 0
Cropped Image Top               : 0
Tone Curve                      : Standard
Sharpness                       : 3
Sharpness Frequency             : n/a
Sensor Red Level                : 0
Sensor Blue Level               : 0
White Balance Red               : 0
White Balance Blue              : 0
Color Temperature               : 5200
Picture Style                   : Auto
Digital Gain                    : 0
WB Shift AB                     : 0
WB Shift GM                     : 0
Measured RGGB                   : 431 1024 1024 768
VRD Offset                      : 0
Sensor Width                    : 5344
Sensor Height                   : 3516
Sensor Left Border              : 152
Sensor Top Border               : 56
Sensor Right Border             : 5335
Sensor Bottom Border            : 3511
Black Mask Left Border          : 0
Black Mask Top Border           : 0
Black Mask Right Border         : 0
Black Mask Bottom Border        : 0
Color Data Version              : 10 (600D/1200D)
WB RGGB Levels As Shot          : 2123 1024 1024 1556
Color Temp As Shot              : 5200
WB RGGB Levels Auto             : 2028 1024 1024 1606
Color Temp Auto                 : 4908
WB RGGB Levels Measured         : 2028 1024 1024 1606
Color Temp Measured             : 4908
WB RGGB Levels Daylight         : 2123 1024 1024 1556
Color Temp Daylight             : 5200
WB RGGB Levels Shade            : 2439 1024 1024 1321
Color Temp Shade                : 7000
WB RGGB Levels Cloudy           : 2280 1024 1024 1431
Color Temp Cloudy               : 6000
WB RGGB Levels Tungsten         : 1540 1024 1024 2341
Color Temp Tungsten             : 3200
WB RGGB Levels Fluorescent      : 1869 1024 1024 2226
Color Temp Fluorescent          : 3729
WB RGGB Levels Kelvin           : 2123 1024 1024 1556
Color Temp Kelvin               : 5200
WB RGGB Levels Flash            : 2367 1024 1024 1411
Color Temp Flash                : 6303
Average Black Level             : 2048 2048 2048 2048
Raw Measured RGGB               : 99047 229396 224807 170653
Per Channel Black Level         : 2047 2047 2048 2048
Normal White Level              : 11767
Specular White Level            : 12279
Linearity Upper Margin          : 10000
Picture Style User Def          : Auto; Auto; Auto
Picture Style PC                : None; None; None
Custom Picture Style File Name  : 
Vignetting Corr Version         : 0
Peripheral Lighting             : Off
Chromatic Aberration Corr       : Off
Peripheral Lighting Value       : 0
Original Image Width            : 5184
Original Image Height           : 3456
Peripheral Lighting Setting     : Off
Peripheral Illumination Corr    : Off
Auto Lighting Optimizer         : Off
User Comment                    : 
Sub Sec Time                    : 46
Sub Sec Time Original           : 46
Sub Sec Time Digitized          : 46
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 5184
Exif Image Height               : 3456
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Focal Plane X Resolution        : 5728.176796
Focal Plane Y Resolution        : 5808.403361
Focal Plane Resolution Unit     : inches
Custom Rendered                 : Normal
Exposure Mode                   : Manual
Scene Capture Type              : Standard
Owner Name                      : CAM1100A1
Serial Number                   : 252076117630
Lens Info                       : 40mm f/?
Lens Model                      : EF40mm f/2.8 STM
Lens Serial Number              : 00002bc0be
Thumbnail Offset                : 55048
Thumbnail Length                : 13072
Photometric Interpretation      : RGB
Samples Per Pixel               : 3
Rows Per Strip                  : 432
Planar Configuration            : Chunky
Strip Offsets                   : 3513124
Strip Byte Counts               : 22248252
Raw Image Segmentation          : 2 1728 1888
SRaw Type                       : 1
Aperture                        : 16.0
Drive Mode                      : Single-frame Shooting
File Number                     : 100-0002
Image Size                      : 5184x3456
Lens                            : 40.0 mm
Lens ID                         : Canon EF 40mm f/2.8 STM
Megapixels                      : 17.9
Preview Image                   : (Binary data 1708300 bytes, use -b option to extract)
Scale Factor To 35 mm Equivalent: 1.6
Shooting Mode                   : Manual
Shutter Speed                   : 1/100
Create Date                     : 2016:10:20 14:46:19.46
Date/Time Original              : 2016:10:20 14:46:19.46
Modify Date                     : 2016:10:20 14:46:19.46
Thumbnail Image                 : (Binary data 13072 bytes, use -b option to extract)
WB RGGB Levels                  : 2123 1024 1024 1556
Blue Balance                    : 1.519531
Circle Of Confusion             : 0.019 mm
Depth Of Field                  : 1.38 m (1.35 - 2.73 m)
Field Of View                   : 31.9 deg
Focal Length                    : 40.0 mm (35 mm equivalent: 62.9 mm)
Hyperfocal Distance             : 5.23 m
Lens                            : 40.0 mm (35 mm equivalent: 62.9 mm)
Light Value                     : 14.6
Red Balance                     : 2.073242

因此,查看二进制数据字段(那些建议使用该-b选项进行提取的字段),我们得到:

Dust Removal Data               : (Binary data 1024 bytes, use -b option to extract)
Preview Image                   : (Binary data 1708300 bytes, use -b option to extract)
Thumbnail Image                 : (Binary data 13072 bytes, use -b option to extract)

Preview Image标签似乎正是我们所寻找的,不过Thumbnail Image是耐人寻味,以及(尽管很小)。

运行以下命令:

exiftool -b .\Kendall_FACS_0002_0100A.cr2 > out.jpg
exiftool -b -PreviewImage .\Kendall_FACS_0002_0100A.cr2 > out.jpg
exiftool -b -ThumbnailImage .\Kendall_FACS_0002_0100A.cr2 > out.jpg

前两个命令导致文件大小为3.28 MB,而最后一个只有25.6KB。在任何程序中都无法打开。Windows Photo Viewer表示无法打开文件,因为the file appears to be damaged, corrputed, or is too large

使用ImageMagick的identify命令可为Preview Image标记提供以下输出

exiftool -b -PreviewImage .\Kendall_FACS_0002_0100A.cr2 | identify -
identify.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.

exiftool -b -PreviewImage .\Kendall_FACS_0002_0100A.cr2 | identify jpg:-
identify.exe: Not a JPEG file: starts with 0x3f 0x3f `-' @ error/jpeg.c/JPEGErrorHandler/322.

我已经在Internet上的其他地方注意到使用该-JpegFromRaw选项的人,但是我的EXIF数据没有这样的标签。

那么,我到底在做什么错呢?

星际极客

在第一个命令中,您将提取所有原始元数据并将其保存到out.jpg中。这将创建一个不是图像的垃圾文件。第二个和第三个命令应该可以工作,并且可以在我拥有的.cr2示例中执行。PreviewImage是一个嵌入式jpg,如果您的相机设置为保存Jpgs + Raw,则该jpg应该与创建的jpg相同。ThumbnailImage是一个非常小的jpg(在我的示例中为160x120),某些程序可以将其用作缩略图,以加快图像的浏览速度。

我相信JpegFromRaw选项用于从一些较旧的相机中提取预览,它可能不会对您的相机做任何事情。

您正在使用哪个版本的exiftool(类型exiftool -ver)?

两者exiftool -b -PreviewImage .\Kendall_FACS_0002_0100A.cr2 > out.jpgexiftool -b -ThumbnailImage .\Kendall_FACS_0002_0100A.cr2 > out.jpg应该工作。

编辑:经过我们之间的一些测试,PowerShell假设exiftool的输出为ASCII,并将其转换为Unicode,从而破坏了输出。

与此相关的网页:
https : //brianreiter.org/2010/01/29/powershells-object-pipeline-corrupts-piped-binary-data/
https://blogs.msdn.microsoft.com/sergey_babkins_blog/2016/12 / 29 /在Powershell中不发送unicode /

总之,命令本身并没有什么问题,而是Powershell处理原始二进制数据。在CMD中运行命令会产生预期的输出。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在Android应用中从大图片中提取和使用图像缩略图

来自分类Dev

使用ffmpeg批量提取缩略图

来自分类Dev

使用缩略图制作模态图像

来自分类Dev

使用缩略图的多模态图像

来自分类Dev

如何使用不带ffmpeg的PHP从视频中提取缩略图?

来自分类Dev

提取PDF缩略图

来自分类Dev

从PHAsset提取缩略图

来自分类Dev

Web2py中的图像缩略图:无法显示缩略图

来自分类Dev

缩略图图像高度

来自分类Dev

从原始图片提取缩略图到特定文件夹的ExifTool语法是什么?

来自分类Dev

使用ffmpeg批量提取多个缩略图?

来自分类Dev

使用ffmpeg批量提取多个缩略图?

来自分类Dev

使用ffmpeg从具有嵌入式封面的文件中提取视频封面/缩略图

来自分类Dev

使用holder.js显示图像缩略图

来自分类Dev

使用holder.js显示图像缩略图

来自分类Dev

无法使用载波生成图像的缩略图

来自分类Dev

使用Perl Image :: Magic创建png图像的缩略图

来自分类Dev

Laravel 5.2:使用干预创建图像缩略图

来自分类Dev

从Android中的MP4文件中提取特定时间的缩略图

来自分类Dev

从视频中提取缩略图以创建子画面在大型视频上确实很慢

来自分类Dev

libgdx创建图像缩略图

来自分类Dev

从Wikimedia Commons获取缩略图图像

来自分类Dev

如何让django缩略图显示图像?

来自分类Dev

单击缩略图,更改图像

来自分类Dev

如何防止缩略图图像拉伸?

来自分类Dev

图像缩略图的坐标计算

来自分类Dev

Cwac相机添加缩略图图像

来自分类Dev

拖放图像并保留其缩略图

来自分类Dev

C ++逐像素图像缩略图