文件转换工具:ConvertX
[gitee网址](https://gitee.com/wiseai/ConvertX.git)
# 一、docker安装
1. 命令安装
```
docker run -p 3000:3000 -e HTTP_ALLOWED=true -e LANGUAGE=zh-CN -v ./data/:/app/data --restart=always --name convertx ghcr.io/c4illin/convertx
```
2. `docker-compose安装`
创建 `docker-compose.yml`文件
```
services:
convertx:
image: ghcr.io/c4illin/convertx
container_name: convertx
restart: unless-stopped
ports:
- "3000:3000" # 将左侧端口映射改为你想要的端口,如3100:3000,避免冲突
environment:
- JWT_SECRET=aLongAndSecretStringUsedToSignTheJSONWebToken1234 # 请务必修改为复杂的随机字符串
- HTTP_ALLOWED=true # 如果通过HTTP访问(非HTTPS),需要启用
- LANGUAGE=zh-CN # 设置界面语言为中文
volumes:
- ./data:/app/data # 持久化存储数据
```
**在该目录下执行命令:** `docker-compose up -d`
# 二、源代码编译安装:
1. ### 首先要安装bun
```bash
# 需要的软件:curl、unzip、git
# 下载安装脚本并安装
curl -fsSL https://bun.sh/install | bash
# 执行脚本时要在github上下载文件https://github.com/oven-sh/bun/releases/download/bun-v1.3.5/bun-linux-aarch64.zip,速度特别慢,建议自已下载并修改脚本安装,安装脚本放在最后面了
ln -s .bun/bin/bun /bin/
```
2. ### 安装ConvertX
```
git clone https://gitee.com/wiseai/ConvertX.git
cd ConvertX
git checkout 最新版本
bun install
bun run build
bun run dist/src/index.js
```
**注意:**如果要远程访问,一定要设置环境变量HTTP\_ALLOWED=true,在docker中用 `-e HTTP_ALLOWED=true`。
转换需要一定的时间,如果没有显示,等一会儿就会出现
3. ### 安装相关软件
要实现各种格式的转换一定要安装对应的软件,下面的就是要安装的软件。
也可以在转换的时候看看错误,上面有提示需要的命令,安装对应的软件就行。
目前安装了ffmpeg、calibre等,一个一个装比较慢。
| Converter | Use case | Converts from | Converts to |
| ---------------------------------------------------------------------------------------------------- | ---------------- | ------------- | ----------- |
| [Inkscape](https://gitee.com/link?target=https%3A%2F%2Finkscape.org%2F) | Vector images | 7 | 17 |
| [libjxl](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Flibjxl%2Flibjxl) | JPEG XL | 11 | 11 |
| [resvg](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2FRazrFalcon%2Fresvg) | SVG | 1 | 1 |
| [Vips](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Flibvips%2Flibvips) | Images | 45 | 23 |
| [libheif](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Fstrukturag%2Flibheif) | HEIF | 2 | 4 |
| [XeLaTeX](https://gitee.com/link?target=https%3A%2F%2Ftug.org%2Fxetex%2F) | LaTeX | 1 | 1 |
| [Calibre](https://gitee.com/link?target=https%3A%2F%2Fcalibre-ebook.com%2F) | E-books | 26 | 19 |
| [LibreOffice](https://gitee.com/link?target=https%3A%2F%2Fwww.libreoffice.org%2F) | Documents | 41 | 22 |
| [Dasel](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2FTomWright%2Fdasel) | Data Files | 5 | 4 |
| [Pandoc](https://gitee.com/link?target=https%3A%2F%2Fpandoc.org%2F) | Documents | 43 | 65 |
| [msgconvert](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Fmvz%2Femail-outlook-message-perl) | Outlook | 1 | 1 |
| [dvisvgm](https://gitee.com/link?target=https%3A%2F%2Fdvisvgm.de%2F) | Vector images | 4 | 2 |
| [ImageMagick](https://gitee.com/link?target=https%3A%2F%2Fimagemagick.org%2F) | Images | 245 | 183 |
| [GraphicsMagick](https://gitee.com/link?target=http%3A%2F%2Fwww.graphicsmagick.org%2F) | Images | 167 | 130 |
| [Assimp](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Fassimp%2Fassimp) | 3D Assets | 77 | 23 |
| [FFmpeg](https://gitee.com/link?target=https%3A%2F%2Fffmpeg.org%2F) | Video | \~472 | \~199 |
| [Potrace](https://gitee.com/link?target=https%3A%2F%2Fpotrace.sourceforge.net%2F) | Raster to vector | 4 | 11 |
| [VTracer](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Fvisioncortex%2Fvtracer) | Raster to vector | 8 | 1 |
| [Markitdown](https://gitee.com/link?target=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fmarkitdown) | Documents | 6 | 1 |
bun的安装脚本:
```
#!/usr/bin/env bash
set -euo pipefail
platform=$(uname -ms)
if [[ ${OS:-} = Windows_NT ]]; then
if [[ $platform != MINGW64* ]]; then
powershell -c "irm bun.sh/install.ps1|iex"
exit $?
fi
fi
# Reset
Color_Off=''
# Regular Colors
Red=''
Green=''
Dim='' # White
# Bold
Bold_White=''
Bold_Green=''
if [[ -t 1 ]]; then
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Dim='\033[0;2m' # White
# Bold
Bold_Green='\033[1;32m' # Bold Green
Bold_White='\033[1m' # Bold White
fi
error() {
echo -e "${Red}error${Color_Off}:" "$@" >&2
exit 1
}
info() {
echo -e "${Dim}$@ ${Color_Off}"
}
info_bold() {
echo -e "${Bold_White}$@ ${Color_Off}"
}
success() {
echo -e "${Green}$@ ${Color_Off}"
}
command -v unzip >/dev/null ||
error 'unzip is required to install bun'
if [[ $# -gt 2 ]]; then
error 'Too many arguments, only 2 are allowed. The first can be a specific tag of bun to install. (e.g. "bun-v0.1.4") The second can be a build variant of bun to install. (e.g. "debug-info")'
fi
case $platform in
'Darwin x86_64')
target=darwin-x64
;;
'Darwin arm64')
target=darwin-aarch64
;;
'Linux aarch64' | 'Linux arm64')
target=linux-aarch64
;;
'MINGW64'*)
target=windows-x64
;;
'Linux riscv64')
error 'Not supported on riscv64'
;;
'Linux x86_64' | *)
target=linux-x64
;;
esac
case "$target" in
'linux'*)
if [ -f /etc/alpine-release ]; then
target="$target-musl"
fi
;;
esac
if [[ $target = darwin-x64 ]]; then
# Is this process running in Rosetta?
# redirect stderr to devnull to avoid error message when not running in Rosetta
if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null) = 1 ]]; then
target=darwin-aarch64
info "Your shell is running in Rosetta 2. Downloading bun for $target instead"
fi
fi
GITHUB=${GITHUB-"https://github.com"}
github_repo="$GITHUB/oven-sh/bun"
# If AVX2 isn't supported, use the -baseline build
case "$target" in
'darwin-x64'*)
if [[ $(sysctl -a | grep machdep.cpu | grep AVX2) == '' ]]; then
target="$target-baseline"
fi
;;
'linux-x64'*)
# If AVX2 isn't supported, use the -baseline build
if [[ $(cat /proc/cpuinfo | grep avx2) = '' ]]; then
target="$target-baseline"
fi
;;
esac
exe_name=bun
if [[ $# = 2 && $2 = debug-info ]]; then
target=$target-profile
exe_name=bun-profile
info "You requested a debug build of bun. More information will be shown if a crash occurs."
fi
if [[ $# = 0 ]]; then
bun_uri=$github_repo/releases/latest/download/bun-$target.zip
else
bun_uri=$github_repo/releases/download/$1/bun-$target.zip
fi
install_env=BUN_INSTALL
bin_env=\$$install_env/bin
install_dir=${!install_env:-$HOME/.bun}
bin_dir=$install_dir/bin
exe=$bin_dir/bun
if [[ ! -d $bin_dir ]]; then
mkdir -p "$bin_dir" ||
error "Failed to create install directory \"$bin_dir\""
fi
curl --fail --location --progress-bar --output "$exe.zip" "$bun_uri" ||
error "Failed to download bun from \"$bun_uri\""
unzip -oqd "$bin_dir" "$exe.zip" ||
error 'Failed to extract bun'
mv "$bin_dir/bun-$target/$exe_name" "$exe" ||
error 'Failed to move extracted bun to destination'
chmod +x "$exe" ||
error 'Failed to set permissions on bun executable'
rm -r "$bin_dir/bun-$target" "$exe.zip"
tildify() {
if [[ $1 = $HOME/* ]]; then
local replacement=\~/
echo "${1/$HOME\//$replacement}"
else
echo "$1"
fi
}
success "bun was installed successfully to $Bold_Green$(tildify "$exe")"
if command -v bun >/dev/null; then
# Install completions, but we don't care if it fails
IS_BUN_AUTO_UPDATE=true $exe completions &>/dev/null || :
echo "Run 'bun --help' to get started"
exit
fi
refresh_command=''
tilde_bin_dir=$(tildify "$bin_dir")
quoted_install_dir=\"${install_dir//\"/\\\"}\"
if [[ $quoted_install_dir = \"$HOME/* ]]; then
quoted_install_dir=${quoted_install_dir/$HOME\//\$HOME/}
fi
echo
case $(basename "$SHELL") in
fish)
# Install completions, but we don't care if it fails
IS_BUN_AUTO_UPDATE=true SHELL=fish $exe completions &>/dev/null || :
commands=(
"set --export $install_env $quoted_install_dir"
"set --export PATH $bin_env \$PATH"
)
fish_config=$HOME/.config/fish/config.fish
tilde_fish_config=$(tildify "$fish_config")
if [[ -w $fish_config ]]; then
{
echo -e '\n# bun'
for command in "${commands[@]}"; do
echo "$command"
done
} >>"$fish_config"
info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_fish_config\""
refresh_command="source $tilde_fish_config"
else
echo "Manually add the directory to $tilde_fish_config (or similar):"
for command in "${commands[@]}"; do
info_bold " $command"
done
fi
;;
zsh)
# Install completions, but we don't care if it fails
IS_BUN_AUTO_UPDATE=true SHELL=zsh $exe completions &>/dev/null || :
commands=(
"export $install_env=$quoted_install_dir"
"export PATH=\"$bin_env:\$PATH\""
)
zsh_config=$HOME/.zshrc
tilde_zsh_config=$(tildify "$zsh_config")
if [[ -w $zsh_config ]]; then
{
echo -e '\n# bun'
for command in "${commands[@]}"; do
echo "$command"
done
} >>"$zsh_config"
info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_zsh_config\""
refresh_command="exec $SHELL"
else
echo "Manually add the directory to $tilde_zsh_config (or similar):"
for command in "${commands[@]}"; do
info_bold " $command"
done
fi
;;
bash)
# Install completions, but we don't care if it fails
IS_BUN_AUTO_UPDATE=true SHELL=bash $exe completions &>/dev/null || :
commands=(
"export $install_env=$quoted_install_dir"
"export PATH=\"$bin_env:\$PATH\""
)
bash_configs=(
"$HOME/.bash_profile"
"$HOME/.bashrc"
)
if [[ ${XDG_CONFIG_HOME:-} ]]; then
bash_configs+=(
"$XDG_CONFIG_HOME/.bash_profile"
"$XDG_CONFIG_HOME/.bashrc"
"$XDG_CONFIG_HOME/bash_profile"
"$XDG_CONFIG_HOME/bashrc"
)
fi
set_manually=true
for bash_config in "${bash_configs[@]}"; do
tilde_bash_config=$(tildify "$bash_config")
if [[ -w $bash_config ]]; then
{
echo -e '\n# bun'
for command in "${commands[@]}"; do
echo "$command"
done
} >>"$bash_config"
info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_bash_config\""
refresh_command="source $bash_config"
set_manually=false
break
fi
done
if [[ $set_manually = true ]]; then
echo "Manually add the directory to $tilde_bash_config (or similar):"
for command in "${commands[@]}"; do
info_bold " $command"
done
fi
;;
*)
echo 'Manually add the directory to ~/.bashrc (or similar):'
info_bold " export $install_env=$quoted_install_dir"
info_bold " export PATH=\"$bin_env:\$PATH\""
;;
esac
echo
info "To get started, run:"
echo
if [[ $refresh_command ]]; then
info_bold " $refresh_command"
fi
info_bold " bun --help"
```
- 共 0 条回复
- 需要登录 后方可回复, 如果你还没有账号请点击这里注册。
wiseAI
✨ 梦初醒 茅塞开
- 不经他人苦,莫劝他人善。
- 能量足,心态稳,温和坚定可以忍。
- 辛苦决定不了收入,真正决定收入的只有一个,就是不可替代性。
- 要么忙于生存,要么赶紧去死!
- 内心强大到混蛋,比什么都好!
- 规范流程比制定制度更重要!
-
立志需要高远,但不能急功近利;
行动需要迅速,却不可贪图速成。 - 不要强求人品,要设计高效的机制。
-
你弱的时候,身边都是鸡零狗碎;
你强的时候,身边都是风和日丽。 - 机制比人品更可靠,契约比感情更可靠。
- 合作不意味着没有冲突,却是控制冲突的最好方法。
- 误解是人生常态,理解本是稀缺的例外。
- 成功和不成功之间,只差一次坚持!
- 祁连卧北雪,大漠壮雄关。
- 利益顺序,过程公开,机会均等,付出回报。
