Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan

bumaociyuan/拼图.bat

Last active Jan 18, 2021
Embed
What would you like to do?
需要 https://www.imagemagick.org/script/binary-releases.php#windows 把拼图.bat 放到 C:\Users\zx\AppData\Roaming\Microsoft\Windows\SendTo\ 里面就可以用右键 发送到 拼图.bat 调用脚本
@echo off
title Concat images vertically
echo Begin
set datetimef=%date:~0,2%-%date:~3,2%_%time:~0,2%-%time:~3,2%-%time:~6,2%
echo %datetimef%
setlocal enabledelayedexpansion
set argCount=0
for %%x in (%*) do (
set /A argCount+=1
set "argVec[!argCount!]=%%~x"
)
echo Number of processed arguments: %argCount%
for /L %%i in (1,1,%argCount%) do echo "!argVec[%%i]!" >> tmp.txt
sort tmp.txt /o p.txt
for /F "tokens=*" %%A in (p.txt) do @magick convert -mattecolor white -smush 15 -append -resize 900 concat-%datetimef%.jpg %%A concat-%datetimef%.jpg
del tmp.txt
del p.txt
@echo off
title Concat images vertically
echo Begin
for /f "tokens=1-3 delims=: " %%i in ("%time%") do (
set hh=%%i
set mm=%%j
set ss=%%k
)
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
set dow=%%i
set month=%%j
set day=%%k
set year=%%l
)
set datetimef==%month%_%day%_%year%_%hh%_%mm%_%ss%
echo datetimef= is %datetimef=%
setlocal enabledelayedexpansion
set argCount=0
for %%x in (%*) do (
set /A argCount+=1
set "argVec[!argCount!]=%%~x"
)
echo Number of processed arguments: %argCount%
for /L %%i in (1,1,%argCount%) do echo "!argVec[%%i]!" >> tmp.txt
sort tmp.txt /o p.txt
for /F "tokens=*" %%A in (p.txt) do @magick convert -mattecolor white -smush 15 -append -resize 900 concat-%datetimef%.jpg %%A concat-%datetimef%.jpg
del tmp.txt
del p.txt
@bumaociyuan

This comment has been minimized.

Copy link
Owner Author

@bumaociyuan bumaociyuan commented Jul 24, 2019

直接在地址栏输入

shell:sendto

就能打开 sendto folder

https://imagemagick.org/download/binaries/ImageMagick-7.0.8-56-Q16-x64-dll.exe

@bumaociyuan

This comment has been minimized.

Copy link
Owner Author

@bumaociyuan bumaociyuan commented Jul 24, 2019

拼图2.bat 优化了时间获取方法
有些系统用 拼图.bat 获取的时间有 斜杆,会导致脚本失败

@bumaociyuan

This comment has been minimized.

Copy link
Owner Author

@bumaociyuan bumaociyuan commented Jan 5, 2021

更新 macos

image

# 找不到 convert 需要手动添加 PATH
export PATH=$PATH:/usr/local/bin/

DIR_PATH=$(dirname $1)

filename=$(date -u +"%Y-%m-%d-%H-%M-%S")".jpg"
output=$DIR_PATH"/$filename"

for var in "$@"
do
    convert -mattecolor white -smush 15 -append -resize 900 $output "$var" $output
done


@bumaociyuan

This comment has been minimized.

Copy link
Owner Author

@bumaociyuan bumaociyuan commented Jan 18, 2021

HEIC 转 jpeg
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment