ã«ã¡ã©ããåçãã³ã³ãã¥ã¼ã¿ã«åãè¾¼ãã ãç¾åã½ããããæ¸ãåºããããã¦JPEGãTIFFã®ãã¡ã¤ã«ã大éã«ã§ããã ãããããªãã¯ããããã¼ããã£ã¹ã¯ã«ä¿åããã ãããã¯ã©ã¦ããµã¼ãã¹ã«ã¢ãããã¼ããã¦ä¿åããã ããããã®ã¾ã¾ä¿åãã¦ãããããä½ããã®å¾å¦çããããããã¨ãããã ããããããèªååããã®ãããã®ã¹ã¯ãªãããcram_image.py ã§ãããåã«ImageMagickã¨ExifToolãé çªã«å¼ã³åºãPythonã¹ã¯ãªãããªã®ã ãããªããªãã©ããã¦ä¾¿å©ãªã®ã§å
¬éãã¦ã¿ããMacOSãLinuxããã®ä»ã®UNIXç³»ã¨ãWindowsã§åãã¯ãã
説æ
å ¸åçãªã¦ã¼ã¹ã±ã¼ã¹ã¯ãLightroomçã§ç¾åããTIFFãã¼ã¿ããGoogle Photosã®ç¡æã¹ãã¬ã¼ã¸ã«ã¢ãããã¼ãã§ãããµã¤ãºã«ãªãµã¤ãºããå·¥ç¨ãèªååãããã¨ã§ããã以前の記事ã«ãæ¸ããããGoogle Photosã®ç¡æã¹ãã¬ã¼ã¸ã«ã¯ãç»ç´ æ°ã1600ä¸ç»ç´ ã¾ã§ã§ãã¼ã¿ãµã¤ãºã50MBã¾ã§ã¨ããæ¡ä»¶ãæºããã°ã容éç¡å¶éã«ãã¼ã¿ãã¢ãããã¼ããããã¨ãã§ãããã¾ããJPEGã¯åå§ç¸®ãããã£ã¦ãã¾ãããTIFFã¯ç¡å£åã§ãã®ã¾ã¾ä¿åãã¦ãããã¨ããã®ããã¤ã³ãã ããªãã°ç¾åãã¼ã¿ãTIFFãã¡ã¤ã«ã«ãã¦Google Photosã«ç½®ãã®ã¯ããèãã ãTIFFãã¢ãããã¼ããã¦ãJPEGã¨ãã¦è¡¨ç¤ºãã¦ãããããå ã®TIFFããã¦ã³ãã¼ããããã¨ãã§ããããæ¤ç´¢ãå å·¥ãå ±æãã§ããããä½ããå®å ¨ç¡æãªã®ã ã
ç»ç´ æ°ã1600ä¸ç»ç´ ã¾ã§ã§ãã¼ã¿ãµã¤ãºã50MiBã¾ã§ã¨ããæ¡ä»¶ã§æ大å質ã®ç»åãä¿åããããªããZIPå§ç¸®16ãããTIFFã1000ä¸ç»ç´ ã»ã©ã«ãªãµã¤ãºãã¦ã¢ãããã¼ãããã¨è¯ãã1000ä¸ç»ç´ ã®TIFFãZIPå§ç¸®ãã¦ã50MBãåãã¨ã¯éããªãã®ã ãã50MBãè¶ ãã¦ãã¾ãå ´åã«ã¯ãå é¨ãã¼ã¿ã®ããã深度ã14ãããã12ãããã«è½ã¨ãã¦å§ç¸®çãä¸ããå¦çã段éçã«è¡ãã確å®ã«50MBãä¸åãããã«ãã¦ããããå®éã«ã¯ããããªããã¨ã ãã8ãããã¾ã§è½ã¨ãã¦ã50MBãåããªãå ´åã«ã¯ç»ç´ æ°ãè½ã¨ãå¦çã段éçã«è¡ãããã«å®è£ ããã¦ãããããããã1000ä¸ç»ç´ ã§ããã°95%以ä¸ã®ã±ã¼ã¹ã§16ãããã§æåããã¯ãã ã14ãããã«ãã©ã¼ã«ããã¯ãããã¨ã4%ãããã12ããã以ä¸ã«ãã©ã¼ã«ããã¯ãããã¨ã1%ããããããããããªããããããã«ããã§ããã ãé«ãè²æ·±åº¦ã®ç»åãã¼ã¿ã50MiiB以ä¸ã§èªåçã«ä½ã£ã¦ãããããã¨ã¯ã§ãããã¼ã¿ãGoogle Photoã«ã¢ãããã¼ãããã°ããã
ãªãµã¤ãºã®éã«ããªããããµã¤ãºã«ãã¦ãããã®ã¯ã以前の記事ã§æ¸ããéãã®ã¢ã«ã´ãªãºã ã«ãããããã¦ããªãµã¤ãºå¦çãè¡ãã«ããã£ã¦ã¯ãããã¾ã以前の記事ã§è¿°ã¹ãè²ç©ºéã®åé¡ããããã¡ã¤ã«ã®åé¡ã«ãã¡ããã¨å¯¾å¿ãã¦ããããã®ã¹ã¯ãªãããå®è£ ããã«ããã£ã¦èª¿æ»ããªãããã®ã ã
ãªãµã¤ãºã®ä»ã«ããä»»æã®ããªãã³ã°ãã¢ã¹ãã¯ãæ¯ãå復ããããã®ããªãã³ã°ããã¤ãºé¤å»ã¨ãã®èªåã¢ã¼ããã¢ã³ã·ã£ã¼ããã¹ã¯ãã¬ãã«è£æ£ã¨ãã®èªåã¢ã¼ããã¬ã³ãè£æ£ã¨ãã®èªåã¢ã¼ããã·ã°ã¢ã¤ãè£æ£ãç·å½¢ããã³éç·å½¢ã®å½©åº¦èª¿æ´ãããã³ãããã¡ã¤ã«ã®å¤æãã§ãããLightroomã§ãåçã®ãã¨ã¯ã§ããããã³ãã³ãä¸çºã§ã§ããã®ã¯ãªããªã楽ã§ããã
å ¥åãã©ã¼ãããã¯TIFFãJPEGãJPEG 2000ãPNGãGIFãBMPã«å¯¾å¿ãã¦ãã¦ãåºåãã©ã¼ãããã¨ãã¦ããããä»»æã«é¸æãã¦å¤æãããã¨ãã§ããã
å ¸åçãªä½¿ãæ¹
ç§ããã使ãããããä½ã£ãã¨ãã使ãæ¹ã説æãããã¾ããç¾åã½ããããåçãã¨ã¯ã¹ãã¼ãããããã®éã«ã16ãããTIFFå½¢å¼ãé¸æãã¦ããããã¡ã¤ã«ã¯é«è²åãªDisplay P3ã«ãã¦ãããæ¸ãåºãæã«ãªãµã¤ãºãã·ã£ã¼ããã¹ã¯ããªãæ¹ãããããããã cram_image.py ãå®è¡ãããç¾åãã¼ã¿ã ~/Pictures ã«æ¸ãåºãããã¨ãã¦ãããããªãµã¤ãºãããã¼ã¿ã ~/photos ã«ä¿åããã«ã¯ã以ä¸ã®ããã«ãããåºåå ã®ãã£ã¬ã¯ããªã¯äºãä½ã£ã¦ãããã¨ã
$ cram_image.py ~/Pictures/*.tif --destination ~/photos
ããããã¨ã以ä¸ã®ãããªãã°ãåºã¦ãå¦çãå®äºãããè¦äºã50MBã®97%ã¾ã§ä½¿ãåã£ãç»åãã¡ã¤ã«ãçæãããã
INFO Processing "/home/mikio/Pictures/P9088382-16.tif" (size=84965818). INFO Converting image [in=tif] [out=tif] [resize from 4608x3072 to 3780x2520] [depth=16] [compress=zip]. INFO Check the file size: 49998028 (97.31%) ... OK. INFO Copying EXIF metadata [in=tif] [out=tif] [note=t:tiff,s:4608x3072,d:16,c:65535,p:display-p3]. INFO Copying ICC profile [Display P3]. INFO Storing as "/home/mikio/photos/P9088382-16.tif".
ãã¯ã»ã«æ°ã®æ大å¤ã¯8ããã深度ã®ç»åã¨16ããã深度ã®ç»åã§å¥ã ã«æå®ã§ãããããã©ã«ãã§ã¯ã8ãããç»åã®ä¸éã¯1600ä¸ãã¯ã»ã«ã16ãããç»åã®ä¸éã¯1000ä¸ãã¯ã»ã«ã«ãªã£ã¦ãããããã¦ãã¡ã¤ã«ãµã¤ãºã®ä¸éã¯50MiBã ãã¤ã¾ãããã©ã«ãè¨å®ã®ã¾ã¾ã§å®è¡ããã°ããã¸ã«ã¡ããåãè¾¼ãã 8ãããJPEGç»åããç¾åã½ããã§æ¸ãåºãã16ãããTIFFç»åããGoogle Photosç¡ææ ã§ã®æé«ç»è³ªãç®æãã¦ãªãµã¤ãºãããããªãµã¤ãºã®å¿ è¦ããªããã¼ã¿ã¯ãã®ã¾ã¾ã³ãã¼ãããã®ã§ãç¡ç¨ãªå£åã®å¿é ããªãã
$ cram_image.py ~/Pictures/*.jpg --destination ~/photo
注æãããã®ã¯ãGoogle Photosã«JPEGãã¢ãããã¼ãããã¨ãããã§åå§ç¸®ãããããã¨ã§ããããã£ã¦ãJPEGãã¡ã¤ã«ãTIFFã«ãã¦ããã¢ãããã¼ãããã¨ãããããããã°åå§ç¸®ã¯ããããªããã表示ç¨ã®JPEGã¯ã¡ããã¨ä½æãããã®ã§ãå©ä¾¿æ§ãåé¡ãªãã大äºãªãã¨ãªã®ã§ããä¸åº¦ãä¸ã®æ¹æ³ã§JPEGã縮å°ãã¦ããã¢ãããã¼ãããã®ã¯å®ã¯æå³ããªããJPEGã®å ´åã160ä¸ãã¯ã»ã«ãè¶ ããç»åãéä¿¡ããã¨ãã¦ããGoogle Photoå´ã§åæã«ç¸®å°å¦çãããã¦ãããããã ãããããå£åãé¿ãã¦ã¢ãããã¼ããããªãã°ãTIFFã«å¤æãã¹ãã ãTIFFæå¼·ã
$ cram_image.py ~/Pictures/*.jpg --destination ~/photo --output_format=tif
第ä¸è ã«æ¸¡ãããã®JPEGãã¼ã¿ãä½ãã«ã¯ãåºåãã©ã¼ããããJPEGã«ãã¦ãç»ç´ æ°ãæ¸ããã¦ãã¢ã³ã·ã£ã¼ããã¹ã¯ãããã¦ãEXIFãã¼ã¿ãåé¤ãããEXIFãã¼ã¿ãåé¤ãã¦ããããã¡ã¤ã«é¢ä¿ã®æ å ±ã ãã¯æ®ãã¦ãããã¨ããããã¤ã³ãã
$ cram_image.py ~/Pictures/*.tif --destination ~/photos --output_format=jpg --max_area 3m --unsharp 1 0.5 --strip_meta
Google Photosã¸ã¢ãããã¼ãããå ´åã«éãããã¨ã«ãããã¼ã¿ãµã¤ãºãä¸å®ä»¥ä¸ã«æããããããã®è¨å®ãããããªãã¨ããå ´åã«ããã®ãã¼ã«ã¯æç¨ã ããªã«ãããã¡ã¤ã«ãµã¤ãºãé¾å¤ä»¥ä¸ã«ãªãã¾ã§è©¦è¡é¯èª¤ããªããç»ç´ æ°ã®ç¸®å°ãè¡ã£ã¦ãããã®ã ãããä¾ãã°Webãµã¤ãã«ã¢ãããã¼ãããäºå®ã®ç»åã512KiB以ä¸ã«æãã¦ä½ããããªãããããã
$ cram_image.py input.jpg --destination ~/photos --max_size=512k --unsharp 1 0.5 --strip_meta
ãã°ãè¦ãã¨æ¶ãã¾ãããããããããã¾ãå ã®ãµã¤ãºã§ä¿åã試ã¿ã¦ããã®ãµã¤ãºãç®æ¨ã®1140%ã ã¨å¤æããããã®ç¶æ³ããä¸éã®ç»ç´ æ°ãæ¨å®ãã¦ããã®å°ãä¸ãã試ãã«ãªãµã¤ãºãã¦ä¿åãã¦ã¿ã¦ãã¾ã 大ããã£ããå°ãæ¸ããã¦ãªãµã¤ãºãã¦ã¨ããå¦çãç¹°ãè¿ããç®æ¨ãéæããããããææç©ã¨ãããPDCAãµã¤ã¯ã«ã
INFO Check the file size: 5841878 (1140.99%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 1152x1536] [depth=8]. INFO Check the file size: 865716 (169.09%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 1080x1440] [depth=8]. INFO Check the file size: 768321 (150.06%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 1044x1392] [depth=8]. INFO Check the file size: 723933 (141.39%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 996x1328] [depth=8]. INFO Check the file size: 664732 (129.83%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 944x1259] [depth=8]. INFO Check the file size: 602003 (117.58%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 896x1195] [depth=8]. INFO Check the file size: 548369 (107.10%) ... Retry. INFO Converting image [in=jpg] [out=jpg] [resize from 3456x4608 to 850x1133] [depth=8]. INFO Check the file size: 500744 (97.80%) ... OK.
ã¤ã³ã¹ãã¼ã«
ï¼è¿½è¨ï¼æ¬ã½ããã¦ã§ã¢ã¯å¾ã«ãJakuzureãã¨ãã¦ããã±ã¼ã¸ãããã®ã§ããã¡ãã®èª¬æãããããã ãããï¼
cram_image.py ãåä½ãããã«ã¯ãPythonã¨ImageMagickãå¿ è¦ã§ãããPythonã®ãã¼ã¸ã§ã³ã¯3以ä¸ãå¿ è¦ã§ã2ç³»ã§ã¯åããªããImageMagickã¯6.9系以ä¸ãæã¾ãããExifToolãå ¥ãã¦ãããæ¹ããEXIFã¿ã°é¢ä¿ã®å¦çãé«éåãããã©ããªãã¦ãåãããã«ãªã£ã¦ããã
cram_image.py ããã¦ã³ãã¼ãããããå®è¡å¯è½ãã¼ããã·ã§ã³ãã¤ãã¦ãã³ãã³ãæ¤ç´¢ãã¹ãéã£ãé©å½ãªå ´æã«ç½®ãã
$ chmod 755 cram_image.py $ sudo cp cram_image.py /usr/local/bin
ãã¾ãã§ã各種ICCプロファイルãã¤ã³ã¹ãã¼ã«ããã¨ããããã¦ã³ãã¼ããã¦å±éãããã/usr/local/share/color/icc ãããã«ç½®ãããããã¡ã¤ã«å¤æãããã«ã¯ãã®æé ãå¿ è¦ã¨ãªãã
$ unzip cram_icc.zip $ sudo mkdir -p /usr/local/share/color/icc $ sudo cp cram_icc/*.icc /usr/local/share/color/icc
ä¸é£ã®ã¤ã³ã¹ãã¼ã«ä½æ¥ã®å¾ã«ã--config ãªãã·ã§ã³ãã¤ã㦠cram_image.py å®è¡ããã¨ã以ä¸ã®ãããªåºåãå¾ãããã¯ãã ã
$ cram_image.py --config
supported format: TIFF -- extensions: tif, tiff supported format: JPEG -- extensions: jpg, jpe, jpeg supported format: JPEG 2000 -- extensions: jp2, j2k supported format: PNG -- extensions: png supported format: GIF -- extensions: gif external command: identify -- version: ImageMagick 6.9.3-3 Q16 x86_64 2016-02-09 http://www.imagemagick.org external command: convert -- version: ImageMagick 6.9.3-3 Q16 x86_64 2016-02-09 http://www.imagemagick.org external command: exiftool -- version: 9.08 icc profile: srgb -- path: /usr/local/share/color/icc/sRGB.icc icc profile: adobe-rgb -- path: /usr/local/share/color/icc/Adobe-RGB.icc icc profile: display-p3 -- path: /usr/local/share/color/icc/Display-P3.icc icc profile: dci-p3 -- path: /usr/local/share/color/icc/DCI-P3.icc icc profile: prophoto-rgb -- path: /usr/local/share/color/icc/ProPhoto-RGB.icc icc profile: rec-2020 -- path: /usr/local/share/color/icc/Rec-2020.icc maximum area for normal color: 16000000 -- maximum size for 1:1: 4000x4000 = 16000000 -- maximum size for 5:4: 4440x3552 = 15770880 -- maximum size for 4:3: 4560x3420 = 15595200 -- maximum size for 7:5: 4620x3300 = 15246000 -- maximum size for 3:2: 4800x3200 = 15360000 -- maximum size for 8:5: 4992x3120 = 15575040 -- maximum size for 16:9: 5184x2916 = 15116544 -- maximum size for 2:1: 5600x2800 = 15680000 maximum area for high color: 10000000 -- maximum size for 1:1: 3100x3100 = 9610000 -- maximum size for 5:4: 3500x2800 = 9800000 -- maximum size for 4:3: 3600x2700 = 9720000 -- maximum size for 7:5: 3696x2640 = 9757440 -- maximum size for 3:2: 3780x2520 = 9525600 -- maximum size for 8:5: 4000x2500 = 10000000 -- maximum size for 16:9: 4160x2340 = 9734400 -- maximum size for 2:1: 4400x2200 = 9680000
ãã«ã
ç°¡æãã«ããè¦ãã«ã¯ã--help ãªãã·ã§ã³ãã¤ãã¦å®è¡ãããããã§ã¯ãªãã·ã§ã³ã®èª¬æã®æ¥æ¬èªè¨³ãæ¸ãã¦ãããã
- -h, --help : ãã«ãã¡ãã»ã¼ã¸ãåºãã
- --version : ãã¼ã¸ã§ã³çªå·ã表示ããã
- --config : ã·ã¹ãã è¨å®ã表示ããã
- --destination path : åºåãã¡ã¤ã«ãæ ¼ç´ãããã£ã¬ã¯ããªãæå®ãããããã©ã«ã㯠~/cram_image.py_output ãmikio@example.com:/home/mikio/spool ã®ãããªSCPã®éä¿¡å ãã£ã¬ã¯ããªãæ¸ããã
- --read_stdin : æ¨æºå ¥åããå ¥åãã¡ã¤ã«ã®ãã¹ãèªã¿è¾¼ãã
- --input_dir path : ãã£ã¬ã¯ããªã«ããå ¥åãã¡ã¤ã«ãèªã¿è¾¼ãã
- --ignore_fresh : 10ç§ä»¥å ã«ä½æã¾ãã¯æ´æ°ãããå ¥åãã¡ã¤ã«ã¯ç¡è¦ããã
- --max_inputs num : èªã¿è¾¼ãå ¥åãã¡ã¤ã«ã®æ°ãå¶éããã
- --timestamp_name : ã¿ã¤ã ã¹ã¿ã³ããåºåãã¡ã¤ã«åã«ããã
- --sequence_name : ã·ã¼ã±ã³ã¹çªå·ããã¡ã¤ã«åã«ããã
- --unique_name : ä¸æã®ååãåºåãã¡ã¤ã«åã«ããã
- --prefix str : åºåãã¡ã¤ã«åã«æå®ããæ¥é è¾ãã¤ããã
- --decollide_name : åºåãã¡ã¤ã«åãæ¢åã®ãã®ã¨è¡çªããå ´åã«ãæ¥å°¾è¾ãã¤ãã¦ä¸æ¸ããåé¿ããã
- --year_subdir : ä½æå¹´ã®ãµããã£ã¬ã¯ããªã®ä¸ã«åºåãã¡ã¤ã«ãæ ¼ç´ããã
- --date_subdir : ä½æå¹´ææ¥ã®ãµããã£ã¬ã¯ããªã®ä¸ã«åºåãã¡ã¤ã«ãæ ¼ç´ããã
- --avoid_mtime : ä½ææ¥æã®æ¨å®ã«ãã¡ã¤ã«ã·ã¹ãã ã®mtimeã使ããªãã
- --cleanup : åºåãæåãããå ¥åãã¡ã¤ã«ãæ¶ãã
- --stash path : å ¥åãã¡ã¤ã«ã移åãããå ã®ãã£ã¬ã¯ããªã
- --ignore_errors : 失æãããã¡ã¤ã«ããã£ã¦ãåæ¢ããã«å¦çãç¶ããã
- --max_area num : ä½æ·±åº¦è²ï¼8ããã以ä¸ï¼ã®åºåç»åã®æ大ç»ç´ æ°ã0以ä¸ãªãç¡å¶éãããã©ã«ãã¯16mï¼1600ä¸ï¼ç»ç´ ã
- --max_area_high num : é«æ·±åº¦è²ï¼9ããã以ä¸ï¼ã®åºåç»åã®æ大ç»ç´ æ°ã0以ä¸ãªãç¡å¶éãããã©ã«ãã¯10mï¼1000ä¸ï¼ç»ç´ ã
- --max_size num : åºåç»åã®æ大ãã¼ã¿ãµã¤ãºï¼ãã¤ãæ°ï¼ãæå®ããã0以ä¸ãªãç¡å¶éãããã©ã«ãã¯50miï¼50MiBï¼ã
- --max_depth num : åºåç»åã®æ大è²æ·±åº¦ãæå®ããã0以ä¸ãªãç¡å¶éãããã©ã«ãã¯12ãããã
- --intact : å ¥åãã¼ã¿ã®ç¸®å°å¦çãããªãã--max_area=0 --max_area_high=0 --max_size=0 --max_depth=0.ã®å¥åã
- --trim_top pc : ç»é¢ä¸é¨ã®ããªãã³ã°ããã¼ã»ã³ãã§æå®ã
- --trim_bottom pc : ç»é¢ä¸é¨ã®ããªãã³ã°ããã¼ã»ã³ãã§æå®ã
- --trim_left pc : ç»é¢å·¦é¨ã®ããªãã³ã°ããã¼ã»ã³ãã§æå®ã
- --trim_right pc : ç»é¢å³é¨ã®ããªãã³ã°ããã¼ã»ã³ãã§æå®ã
- --trim t b l r : ä¸ä¸å·¦å³ã®ããªãã³ã°ããã¼ã»ã³ãã§æå®ã
- --trim_aspect w h : ããªãã³ã°ãã¦ã¢ã¹ãã¯ãæ¯ãæå®ãããã®ã«ããã
- --trim_core : æ大ç»ç´ æ°ãæºããã¹ãããªãã³ã°ãããã¢ã¹ãã¯ãæ¯ã¯ç¶æããããã--trim_aspect ã«å¾ãã
- --resize w h : ç»åãæå®ãµã¤ãºã«ãªãµã¤ãºãããã©ã¡ãããã¼ããªããé·è¾ºãåããããã©ã¡ããã両æ¹ãè² æ°ãªãã縮å°ã ãè¡ãã
- --denoise num : æå®ããåå¾ã§ãã¤ãºé¤å»ãè¡ããè² æ°ãªãèªåå¤å®ããã
- --unsharp s g : æå®ããã·ã°ãã¨ã²ã¤ã³ã§ã¢ã³ã·ã£ã¼ããã¹ã¯ãããããã·ã°ããè² æ°ãªãã¼ããå¦çãè¡ãã
- --level b w : æå®ãããã©ãã¯ãã¤ã³ãã¨ãã¯ã¤ããã¤ã³ãã®ãã¼ã»ã³ãã¼ã¸ã§ãã¬ãã«è£æ£ãè¡ãã
- --gamma num : ã¬ã³ãè£æ£ãè¡ããã¼ããè² æ°ãªãèªåè£æ£ãè¡ãã
- --contrast s m : æå®ããã·ã°ãã¨ãã¼ã»ã³ãã®ä¸éç¹ã§ã·ã°ã¢ã¤ãè£æ£ãè¡ãã è² æ°ãªãéé¢æ°ãé©ç¨ãããã
- --saturation num : æå®ããä¿æ°ã§å½©åº¦ãå¢ãããè² æ°ãªã彩度ã®ã¬ã³ãè£æ£ãè¡ãã
- --filter name : ã°ã¬ã¼ã¹ã±ã¼ã«å¤æãè¡ãã[gray, gray-709, gray-r, gray-o, gray-y, gray-g, gray-b]
- --profile name : ååãæå®ãã¦ãããã¡ã¤ã«ã®å¤æãè¡ãã
- --strip_meta : EXIFãITPCãXMPçã®ã¡ã¿ãã¼ã¿ãåé¤ããã
- --output_format fmt : åºåå½¢å¼ãæå®ããã[tif, jpg, jp2, png, gif, bmp]
- --log_level level : ãã°ã¬ãã«ãæå®ããã[debug, info, warning, error]
ç´°ãã話ã ãã--max_area 㨠--max_area_high ã¨--max_size ã«ã¯SIæ¥é è¾ã使ããã160000000ã¨æ¸ãã®ãé¢åãªå ´åã«ã16m ã¨æ¸ããã16M ã§ããããk ã¯1000ãm ã¯1000^2ãg 㯠1000^3 ã®æå³ã ãã¾ããki ã¨æ¸ãã¨1024ãmi ã¨æ¸ã㨠1024^2ãgi ã¨æ¸ã㨠1024^3 ã®æã«ãªãã
é²ãã 使ãæ¹
16ãããã®è²æ·±åº¦ã§ä¿åããã®ã¯æããã«ãªã¼ãã¼ã¹ããã¯ã ããã¤ã¨ã³ãã®ãã¸ã«ã¡ã§ã14ãããRAWã ãã12ãããRAWã®æ©ç¨®ãæ®éã«ãããããã¦ImageMagickã®ä½æ¥ç©ºéã16ãããã§ãããã¨ãèããã¨ãä¿åæã®è²æ·±åº¦ã ãã大ãããããã¨ã«ãã¾ãæå³ã¯ãªããä¿åæã«ã¯12ãããã§ååã§ãããcram_image.py ã®ããã©ã«ãããã®è¨å®ã«ãªã£ã¦ããã12ãããã®ç»åãã¼ã¿ãZIPå§ç¸®TIFFã«å¤æããå ´åã65%ã»ã©ã«å§ç¸®ããããã¨ãå¤ãã1200ä¸ç»ç´ ã®ç»åãå§ç¸®ããã¨44MBç¨åº¦ã«ãªãè¨ç®ã«ãªãã®ã§ãå§ç¸®çã®å¤å°ã®å¤åããã£ã¦ã50MBã«åã¾ããã¨ãã»ã¨ãã©ã ãã§ããã ãç»ç´ æ°ã大ããããã人ã«ã¯ãã®è¨å®ãããããã§ããã
$ cram_image.py ~/Pictures/*.tif --destination ~/photos --max_area_high 12m
ã¡ãªã¿ã«ãTIFFãPNGã®è²æ·±åº¦ã¨ãã¦12ããããæå®ããå ´åãå®éã®ãã¼ã¿ã«ãããã³ã³ãã¼ãã³ããããæ°ã¯16ãããã«è¨å®ãããããã®16ãããå ã®ä¸ä½12ãããã使ãã¨ãããã¨ã ãå é¨ã§ä½¿ãããdeflateå§ç¸®ã®é½åä¸ããã¤ãåä½ã«ãªã£ã¦ããæ¹ãæçµçãªãã¼ã¿ãµã¤ãºãå°ãããªãã®ã ãJPEG 2000ã®å ´åã¯ãã®éãã§ã¯ãªãã12ãããã¨æå®ããã12ãããã®ã¾ã¾ã§ã¨ã³ã³ã¼ãå¦çãããã¦åºåããã
ãã®ãã¼ã«ãå°å ¥ãã¦ããããããã¡ã¤ã«ã®å¤æã楽ã«ãªã£ãã®ã§ãã¤ãã«REC. 2020ãå°å ¥ããããã¤ã³ã¹ãã¼ã«æé ã®ã¨ããã§è¿°ã¹ãICCãã¡ã¤ã«ãã¤ã³ã¹ãã¼ã«ãããªãã°ã--profile rec-2020 ã¨ãæå®ããã¨ãç¾å¨ã®è²ç©ºéããREC. 2020ã«ãã¼ã¿ãå¤æããä¸ã§ãã®ãããã¡ã¤ã«ãã¤ãã¦ããããREC. 2020ã¯Display P3ã®ä¸ä½äºæã®ãããªä½ç½®ä»ãã§ã人éãç¥è¦ã§ããè²ã®ããªãã®é¨åãã«ãã¼ããè²åãåãã¦ãããããã§ãã¦ã¬ã³ãç¹æ§ãsRGBã¨åããªã®ã§æ±ãããããè²åãåºãã ãã ã£ããLightroomãPhotoShopã§ã使ããã¦ããProPhoto RGBã§ãããã®ã ããProPhoto RGBã¯äººéãç¥è¦ã§ããé åãè¶ãã¦ãã¦ç¡é§ãå¤ããã¬ã³ãã1.6ãªã®ãã¡ãã£ã¨æ±ãã«ãããREC. 2020ã¯ã¹ã¼ãã¼ãã¤ãã¸ã§ã³ãHDR+ãªã©ã®è¦æ ¼ã§ãç¾å®çã«ä½¿ãããã£ã½ãã®ã§ã表示ç°å¢ããããã¯ã¤ãã¦ããã ããããã£ã¦ãå°æ¥ã®ç°å¢ã§é²è¦§ãããã¨ãè¦è¶ãããã¡ã¤ã«ãã¢ãããã¼ãããããªãã16ãããTIFFãREC. 2020ãããã¡ã¤ã«ã§æ¸ãåºãã®ãçæ³ã ãæ®å¿µãªããç¾ç¶ã§Lihgtroomã¯REC. 2020ãããã¡ã¤ã«ã«å¯¾å¿ãã¦ããªãã®ã§ãProPhoto RGBã§æ¸ãåºãã¦ããããããREC. 2020ã«å¤æããæé ãã¨ãã
$ cram_image.py ~/Pictures/*.tif --destination ~/photos --profile rec-2020
以åã«ãè¿°ã¹ãããããã¯ã¢ããã¯ãã¼ã«ã«ã¨ã¯ã©ã¦ãã®ä¸¡æ¹ã«æã£ã¦ããã¹ãã ããã¼ã«ã«ã«ã¯ãã¼ã«ã«ã®ãã¯ã©ã¦ãã«ã¯ã¯ã©ã¦ãã®ãªã¹ã¯ãããããã¦ãã¯ã©ã¦ãã®æ¹ã¯Google Photosã«ã¯1000ä¸ç»ç´ ãã1600ä¸ç»ç´ ã®ç»åãã¢ãããã¼ããã¦ããã¨ãã¦ããã¼ã«ã«ã§ã¯ç¸®å°ããªãã§æã£ã¦ããã¦ãããããã®å ´åã«ã¯ã--intact ãæå®ãã¦ç»ç´ æ°å¶éã¨ãã¼ã¿ãµã¤ãºå¶éãå¤ãã°ãããããããã¨åã«ãããã¡ã¤ã«ã®å¤æããã¦ãããã¼ã¿ãã³ãã¼ããã ãã®ãã¼ã«ã«ãªã£ã¦ãã¾ãã®ã ããããã§ããããã便å©ã ã
$ cram_image.py ~/Pictures/*.tif --destination ~/photos --intact --profile rec-2020
æºãè¾¼ãã§ããæ¢åã®å¤§éã®ç»åãã¡ã¤ã«ã«ä¸æ¬å¦çãè¡ãããå ´åãã³ãã³ãã©ã¤ã³ãããã¡ã¤ã«åã®ãªã¹ããæå®ããæ¹å¼ã ã¨ç ´ç¶»ãããããã§ã--read_stdin ãªãã·ã§ã³ãæå®ãã¦æ¨æºå ¥åãããã¡ã¤ã«åã®ãªã¹ããèªã¿è¾¼ã¾ãããã¨ãã§ãããããã find ã³ãã³ãã¨çµã¿åãããã®ã常å¥æ段ã ã
$ find ~/photo-album/2018 -type f -name '*.tif' | cram_image.py --read_stdin --destination ~/photos ---intact --profile rec-2020
ãã¼ããã£ã¹ã¯ã®å®¹éå価ã¯å®ãã¨ã¯ãããéå¯éå§ç¸®ãã¼ã¿ãä¿åãã¦å®¹éãç¯ç´ãããã¨èãããã¨ãããã ãããJPEGã¯8ããã深度åºå®ãªã®ã§ãé«ãè²åã®ãã¼ã¿ãä¿åããã«ã¯ãã¾ãåãã¦ããªããããã§ãJPEG 2000ãå°å ¥ãã¦ã¿ãã--output_format ã§åºåå½¢å¼ãjp2ã«æå®ãããèªå縮å°å¦çãåé¿ãã¹ãã--max_area_high 0 --max_size 0 ãæå®ããã
$ cram_image.py ~/Pictures/*.tif --destination ~/photos --max_area_high 0 --max_size 0 --profile rec-2020 --output_format jp2
ã ããããã大å¤æ®å¿µãªãã¨ã«ãJPEG 2000ã¯ãããã¡ã¤ã«ã®æã¡æ¹ãæ¨æºåããã¦ãããããããã¡ã¤ã«ãåãè¾¼ããªãã®ã ãä»æ¹ãªãã®ã§åºåãJPEG 2000ã®å ´åã¯ICCProfileNameã¨ããã¿ã°ã«ãããã¡ã¤ã«åã ããåãè¾¼ãã§ãããããã ãã§ã¯ã¾ã¨ããªè²ã§é²è¦§ã§ããªãããã ããé²è¦§æã«ãã®ã¡ã¿ãã¼ã¿ãè¦ã¦å¾©å ããã°ä½ã¨ãè¦ãããããã«ãªããæ¥å¸¸çãªé²è¦§ã¯Google Photosã§è¡ãã®ã§ã復å å¯è½æ§ã ãæ ä¿ãã¦ããã°å®ç¨ã«ãªãã ããã
$ find ~/photo-album/2018 -type f -name '*.jp2' | cram_image.py --read_stdin --destination ~/photos --intact --output_format jpg
åºè²åãããã¡ã¤ã«ã§12ããã以ä¸ã®TIFFãJPEG 2000ã¨ãã¦ç»åãä¿åãã¦ããã°ãç¨éã«å¿ãã¦ç»åãåå å·¥ããéã«ãè²ãç ´ç¶»ãããã¨ããªããããªã³ãåçã¨éã£ã¦ãã¸ã¿ã«åçã¯ãè²ãã³ã³ãã©ã¹ããã·ã£ã¼ããã¹ã¯é²è¦§ç°å¢ããã®æã®æ°åã«åããã¦è¨å®ãã¹ããã®ã ããªã®ã§ãä¿åããç»åãã¼ã¿ã¯ã§ããã ããã¥ã¼ãã©ã«ãªè¨å®ã«ãã¦ãã·ã£ã¼ããã¹ã¯ä¸åãããªãæ¹ãããããã£ã¨è¨ãã°ãRAWãã¡ã¤ã«ãä¿åããã®ãæãæ½°ããããã®ã ããããããã¨æ°è»½ã«é²è¦§ã§ããªãã®ãè¾ãããªã®ã§ãç§ã¯ãLightroomä¸ã§é¸å®ãããã¼ãåçã®å ¨ã¦ã¯åºæ¬çã«TIFFã§Google Photosã®ç¡ææ ã«ã¢ãããã¼ããã¦ãç¹ã«æ°ã«å ¥ã£ãRAWãã¡ã¤ã«ã ãã¯ãã®ã¾ã¾ãã¼ã«ã«ã«ä¿åãã¦ããããã«ãã¦ãããRAWãã¡ã¤ã«ãGoogle Driveã«ã¢ãããã¼ãããã®ãããèãã ï¼Google Photosã ã¨JPEGã«å¤æãããã®ã§ï¼ãæã«æ°æã®ãæ°ã«å ¥ããä¿åããã ãã ã£ããå½é¢ã¯å®¹éãæã¤ã ããã
æã£ã¦ããåçã®ãµã ãã¤ã«ã大éã«ä½ãå¿ è¦ãããæã¯ããããªé¢¨ã«ããã--trim_aspect ã§æå®ããã¢ã¹ãã¯ãæ¯ã«ãªãããã«ããªãã³ã°ãã¦ããã®å¾ã« --resize ã§ãµã¤ãºã縮å°ãã¦ãããã¢ã¹ãã¯ãæ¯ãä¿ã£ãã¾ã¾ã«ãããå ´åã--trim_aspect ã¯çç¥ããããµã ãã¤ã«ã¯ãã¼ã¿ãµã¤ãºãå°ãããããã®ã§ --strip_meta ã§ã¡ã¿ãã¼ã¿ã¨ãããã¡ã¤ã«ãå¥ãåã£ã¦ããããsRGBç»å以å¤ã§ãããã¡ã¤ã«ãå¥ãåãã¨è²ããããããªãã®ã§ã--profile ã§sRGBã«å¤æãã¦ãããããæ£ç¢ºã«è¨ãã¨ããããã¡ã¤ã«ãsRGBã®å ´åã«ã®ã¿ãããã¡ã¤ã«ãã¼ã¿ãå¥ãåãããä»æ§ã«ãªã£ã¦ããã
$ find ~/photo-album/2018 -type f -name '*.tif' | cram_image.py --read_stdin --destination ~/photos --trim_aspect 1 1 --resize 256 0 --profile srgb --strip_meta --output_format jpg
åºåãã¡ã¤ã«ãå ¨ã¦åä¸ã®ãã£ã¬ã¯ããªã«å ¥ããããã¨ç®¡çãç ©éã«ãªãã®ã§ãå ¥åãã¡ã¤ã«ã®ä½ææ¥æãã¨ã«ãµããã£ã¬ã¯ããªã«åããæ©è½ãããã--year_subdir 㯠1978 ã®ãããªå¹´ã®ãµããã£ã¬ã¯ããªãä½ãã--date_subdir 㯠1978-02-11 ã®ãããªå¹´ææ¥ã®ãµããã£ã¬ã¯ããªãä½ãã両æ¹æå®ãã㨠1978/1978-02-11 ã®ããã«ãªããä½ææ¥æã¯EXIFã®DateTimeOriginalã¿ã°ããèªã¿åãããããããªããã°ãã¡ã¤ã«ã·ã¹ãã ã®mtimeå±æ§ãèªããmtimeãèªã¿ãããªãå ´åã«ã¯ --avoid_mtime ãã¤ããããã®éã«æ¥æãèªã¿åããªãå ´å㯠0000 ã 0000-00-00 ã®ãããªååã«ãªãã
$ find ~/photo-album -type f -name '*.tif' | cram_image.py --read_stdin --destination ~/photos --year_subdir --date_subdir --avoid_mtime
åºåå ã®ãã£ã¬ã¯ããªã¯ scp ã®åºåæå®ã使ããã®ã§ãåºåçµæããªã¢ã¼ãã®ãµã¼ãã«éããã¨ãã§ãããscpã¯éµãé©åã«è¨å®ãã¦ãã¹ã¯ã¼ããªãã§éä¿¡ã§ããããã«ãã¦ãããã¨ã
$ cram_image.py ~/Pictures/*.tif --destination [email protected]:photo-album --date_subdir
ç§ãããããããã®ã¯ãLightroomã§æ¸ãåºããTIFFãã¡ã¤ã«ã®åºåããã¼ãªã³ã°ãã¦ããªãµã¤ãºããä¸ã§å³æã«èªåã®ãµã¼ãã«éãã¨ããå¦çã ããã®éã«ã¯ --ignore_fresh ãæå®ãã¦ããã¨ãæ´æ°10ç§ä»¥å ã®ãã¡ã¤ã«ãç¡è¦ããã®ã§ãæ¸ãåºãä¸ã®ãã¡ã¤ã«ãå¦çãããã¨ãé²ããã¨ãã§ãããLightroomã®åºåå¦çãã¢ãããã¯ã«ãªã£ã¦ãããå¦ãã¯ç¥ããªããã念ã®ãããã¾ãã--cleanup ãæå®ãã¦ãå¦çãæåããéã«ã¯å ¥åãã¡ã¤ã«ãæ¶ãããããã«ãã¦ãããããã«ãã£ã¦åããã¡ã¤ã«ã¯ä¸åº¦ããå¦çãããªããªãã
$ while true ; do cram_image.py ~/Pictures/*.tif --destination [email protected]:photo-album --ignore_fresh --cleanup ; sleep 100 ; done
ã¾ã¨ãã«ãã¼ãªã³ã°å¦ççãªãã¨ãããããªãcrontabã§å®æèµ·åããã¦ãç¹å®ã®ãã£ã¬ã¯ããªã®ãã¡ã¤ã«ãå¦çããã ããããã®éã«ã--stash ãªãã·ã§ã³ã§å ¥åãã¡ã¤ã«ã®éé¿ãã£ã¬ã¯ããªãæå®ããã¨è¯ããå¦çä¸ã®ãã¡ã¤ã«ã¯ã©ããå¥ã®å ´æã«éé¿ããã¦ãããå¦çãæåãããããããæ¶ãããã«ãããå¦çã«å¤±æããå ´åã«ã¯å ¥åãã¡ã¤ã«ã¯ç£è¦å¯¾è±¡ã®ãã£ã¬ã¯ããªããæ¶ãããéé¿å ã«ã¯æ®ã£ã¦ããã®ã§ãå½è©²ãã¡ã¤ã«ã®å復å¦çãåå 解æã«å½¹ç«ã¤ããã¡ã¤ã«ç§»åã¯ã¢ãããã¯ã«è¡ãããã®ã§ãä¸ãä¸äºéèµ·åãã¦ãã¾ã£ãéã®ã¬ã¼ã¹ã³ã³ãã£ã·ã§ã³ãåé¿ãããã¨ã«ããªãããã ããå®éã®ã¨ãããcram_image.py ã¯ããã¯ãã¡ã¤ã«ã¨lockfé¢æ°ã使ã£ãæä»å¶å¾¡ãå®è£ ãã¦ããã®ã§ãäºéèµ·åãã¦ãã©ã¡ããããã¡ã¤ã«ã®èªã¿åãã«å¤±æãã¦çµäºããã ããªã®ã§åé¡ãªãã
$ cram_image.py /home/mikio/Pictures/*.tif --destination [email protected]:photo-album --ignore_fresh --cleanup --stash /home/mikio/cram_image.py_stash
ãªããUNIXç³»ã§crontabã使ã£ã¦äºéèµ·åãé²æ¢ãã¤ã¤å®æèµ·åããã«ã¯ã以ä¸ã®ããã«crontabãè¨å®ãããããããã¨1åã«1åã®é »åº¦ã§ /tmp/auto_photo_upload.lock ãããã¯ããä¸ã§ã/usr/local/sbin/auto_photo_upload.sh ãå®è¡ããããã«ãªããããã¯ãç²å¾ã§ããªãå ´åã«ã¯ä½ãããªããã§ããã¨ã¯ãã®ã¹ã¯ãªããã«é©å½ãªå¦çãæ¸ãã°ãããfindã§å ¥åãã¡ã¤ã«ã®ãªã¹ããåãã¨ãã¦ãfindã®å¦çã¯cram_image.pyã®å¤å´ã®è©±ãªã®ã§ãæä»å¶å¾¡ãå¥éã«æ½ãã®ãæã¾ããã
* * * * * flock -n /tmp/auto_photo_upload.lock /usr/local/sbin/auto_photo_upload.sh >>/var/log/auto_photo_upload.log
å®éã«ImageMagickãExiftoolãã©ããªé¢¨ã«å¼ã°ãã¦ãããèå³ããã人ã¯ã--log_level debug ãã¤ãã¦å®è¡ããã¨ããããããªã«è¤éã£ã¦ããã§ããªãããã©ãæã§ããã®ãé¢åãããã£ã¦ãã¨ã¯åããã¨æãã
ãã¡ããã¦ããããã¹ããæ¸ãã¦ããã®ã§ãå®è¡ãããå ´åã«ã¯ã--test ãã©ã°ãã¤ããããã¹ãã¯ImageMagickã¨Exiftoolã¨å種ICCãããã¡ã¤ã«ãã¤ã³ã¹ãã¼ã«ããã¦ãããã¨ãåææ¡ä»¶ã¨ããã
$ cram_image.py --test
ã¾ã¨ã
åçãç¾åãã¦ã¯ã©ã¦ããµã¼ãã¹ã¨ãã¼ã«ã«ã¹ãã¬ã¼ã¸ã«ä¿åããããã®ä¸é£ã®åå¦çãèªååããã¹ã¯ãªãããæ¸ãã¦ã¿ããæ¡ä»¶ãå¤ããªããææ©çã«ãªãµã¤ãºã試ã¿ãã®ããã¤ã³ããã¿ããªå¤§å¥½ãã ãã©ã¹ãã«ã¿ã³ãããImageMagickã ããåã ã®å¦çãæã§å ¥åããã®ã¯é¢åãããããããã£ã¦ã¹ã¯ãªãããæ¸ãã¦èªååããã¨ãããªãå¼·åã§ä¾¿å©ãªãã¼ã«ã«ãªãã
sRGBã®JPEGãä¿åããã®ããããã©ãDisplay P3ãRec.2020ã®16ãããTIFFãJPEG 2000ãä¿åããã®ãç¾å®çã«ãªã£ã¦ããã容éã®åé¡ã¯å¤§å®¹éãã¼ããã£ã¹ã¯ã®ä½ä¾¡æ ¼åã¨ã¯ã©ã¦ããµã¼ãã¹ã®ç¡æåã§å æãããã®ã ãããããé«å質ãªãã¼ã¿ã®ä¿åãç®æãã¹ãã ããã®ãã¼ã«ããã®ä¸å©ã«ãªãã°å¹¸ãã§ããã