前言

每天上班路上,都会随手拍两张照片,作为个人的打卡记录,此外,中午和同事吃饭,节假日聚餐,都会拍一些存下来。
日积月累,为了节省手机空间,我会定期把手机里的照片导出到外部存储设备。
这样在手机使用方面,面临几个问题,简单做下记录。

手机媒体文件导出

方法有很多,可以安装百度网盘,也可以自建NAS存储。
采用最简单的方法,用数据线连接电脑和手机,把手机上的资料导出来,关键用到一个软件”爱思助手7.0”。
之前使用itool, 后来这个软件没有维护,已不能正常使用,软件打开是这个界面,可以很方便选中文件向外导出。

爱思助手7 爱思助手7

还有一个方法,使用snapdrop工具箱,官网:https://snapdrop.net/
手机和PC同时打开,双方相互发现后,就能互传文件,这个工具也可以使用docker部署,还算方便。
snapdrop

图片压缩

由于个人空间有限,还有图片压缩的需求,网络上很轻松就找到了。

JpegOptim

JpegOptim 是用于优化jpeg文件的实用程序。提供无损优化(基于优化霍夫曼表)和基于设置最大品质因数的“有损”优化。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

$ sudo apt install jpegoptim
# 使用帮助
$ optipng jpegoptim -h
Synopsis:
optipng [options] files ...
Files:
Image files of type: PNG, BMP, GIF, PNM or TIFF
Basic options:
-?, -h, -help show this help
-o <level> optimization level (0-7) [default: 2]
-v run in verbose mode / show copyright and version info
General options:
-backup, -keep keep a backup of the modified files
-clobber overwrite existing files
-fix enable error recovery
-force enforce writing of a new output file
-preserve preserve file attributes if possible
-quiet, -silent run in quiet mode
-simulate run in simulation mode
-out <file> write output file to <file>
-dir <directory> write output file(s) to <directory>
-log <file> log messages to <file>
-- stop option switch parsing
Optimization options:
-f <filters> PNG delta filters (0-5) [default: 0,5]
-i <type> PNG interlace type (0-1)
-zc <levels> zlib compression levels (1-9) [default: 9]
-zm <levels> zlib memory levels (1-9) [default: 8]
-zs <strategies> zlib compression strategies (0-3) [default: 0-3]
-zw <size> zlib window size (256,512,1k,2k,4k,8k,16k,32k)
-full produce a full report on IDAT (might reduce speed)
-nb no bit depth reduction
-nc no color type reduction
-np no palette reduction
-nx no reductions
-nz no IDAT recoding
Editing options:
-snip cut one image out of multi-image or animation files
-strip <objects> strip metadata objects (e.g. "all")
Optimization levels:
-o0 <=> -o1 -nx -nz (0 or 1 trials)
-o1 <=> -zc9 -zm8 -zs0 -f0 (1 trial)
(or...) -zc9 -zm8 -zs1 -f5 (1 trial)
-o2 <=> -zc9 -zm8 -zs0-3 -f0,5 (8 trials)
-o3 <=> -zc9 -zm8-9 -zs0-3 -f0,5 (16 trials)
-o4 <=> -zc9 -zm8 -zs0-3 -f0-5 (24 trials)
-o5 <=> -zc9 -zm8-9 -zs0-3 -f0-5 (48 trials)
-o6 <=> -zc1-9 -zm8 -zs0-3 -f0-5 (120 trials)
-o7 <=> -zc1-9 -zm8-9 -zs0-3 -f0-5 (240 trials)
-o7 -zm1-9 <=> -zc1-9 -zm1-9 -zs0-3 -f0-5 (1080 trials)
Notes:
The combination for -o1 is chosen heuristically.
Exhaustive combinations such as "-o7 -zm1-9" are not generally recommended.
Examples:
optipng file.png (default speed)
optipng -o5 file.png (slow)
optipng -o7 file.png (very slow)

# 基本用法
$ jpegoptim filename.jpeg
$ jpegoptim [options] filename.jpeg

# 如当前有两个目录,-m50是指压缩品质,取值范围 0-100
jpegoptim -m50 ./origin/*.png --dest ./compress
#指定大小
jpegoptim --size=200k ./origin/*.png --dest ./compress

# 批量处理,使用 find、xargs 这样的工具可以压缩你指定的一些文件
$ find . -name "*.jpg" | xargs jpegoptim

OptiPNG

PNG图片格式的说明

官方地址:https://optipng.sourceforge.net/
PNG全称是”Portable Network Graphics”,是一种存储压缩后的光栅图的格式,压缩引擎基于 Deflate算法 [RFC1951], 由 PKWare设计,最开始应用于 PKZIP
更详细信息见:https://optipng.sourceforge.net/pngtech/optipng.html

OptiPNG 是一个PNG优化器,可将图像文件重新压缩为更小的尺寸,而不会丢失任何信息。该程序还将外部格式转换为优化后的PNG,并执行PNG完整性检查和更正。
处理的文件类型:Image files of type: PNG, BMP, GIF, PNM or TIFF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# 安装
$ sudo apt install optipng
# 使用帮助
$ optipng -h
Synopsis:
optipng [options] files ...
Files:
Image files of type: PNG, BMP, GIF, PNM or TIFF
Basic options:
-?, -h, -help show this help
-o <level> optimization level (0-7) [default: 2]
-v run in verbose mode / show copyright and version info
General options:
-backup, -keep keep a backup of the modified files
-clobber overwrite existing files
-fix enable error recovery
-force enforce writing of a new output file
-preserve preserve file attributes if possible
-quiet, -silent run in quiet mode
-simulate run in simulation mode
-out <file> write output file to <file>
-dir <directory> write output file(s) to <directory>
-log <file> log messages to <file>
-- stop option switch parsing
Optimization options:
-f <filters> PNG delta filters (0-5) [default: 0,5]
-i <type> PNG interlace type (0-1)
-zc <levels> zlib compression levels (1-9) [default: 9]
-zm <levels> zlib memory levels (1-9) [default: 8]
-zs <strategies> zlib compression strategies (0-3) [default: 0-3]
-zw <size> zlib window size (256,512,1k,2k,4k,8k,16k,32k)
-full produce a full report on IDAT (might reduce speed)
-nb no bit depth reduction
-nc no color type reduction
-np no palette reduction
-nx no reductions
-nz no IDAT recoding
Editing options:
-snip cut one image out of multi-image or animation files
-strip <objects> strip metadata objects (e.g. "all")
Optimization levels:
-o0 <=> -o1 -nx -nz (0 or 1 trials)
-o1 <=> -zc9 -zm8 -zs0 -f0 (1 trial)
(or...) -zc9 -zm8 -zs1 -f5 (1 trial)
-o2 <=> -zc9 -zm8 -zs0-3 -f0,5 (8 trials)
-o3 <=> -zc9 -zm8-9 -zs0-3 -f0,5 (16 trials)
-o4 <=> -zc9 -zm8 -zs0-3 -f0-5 (24 trials)
-o5 <=> -zc9 -zm8-9 -zs0-3 -f0-5 (48 trials)
-o6 <=> -zc1-9 -zm8 -zs0-3 -f0-5 (120 trials)
-o7 <=> -zc1-9 -zm8-9 -zs0-3 -f0-5 (240 trials)
-o7 -zm1-9 <=> -zc1-9 -zm1-9 -zs0-3 -f0-5 (1080 trials)
Notes:
The combination for -o1 is chosen heuristically.
Exhaustive combinations such as "-o7 -zm1-9" are not generally recommended.
Examples:
optipng file.png (default speed)
optipng -o5 file.png (slow)
optipng -o7 file.png (very slow)

参考:https://www.jianshu.com/p/db7a88062f66