openmynet 最近的时间轴更新
openmynet

openmynet

V2EX 第 183627 号会员,加入于 2016-07-25 17:52:18 +08:00
openmynet 最近回复了
11 天前
回复了 wencan 创建的主题 Linux Linux 下有没有很方便的图片拼接软件?
https://github.com/theotherphil/imagecli 需要你自己编译到 Linux 版本,再配合 python 很容易满足你的要求
```python
import os
import subprocess
import argparse
from PIL import Image
import re

if __name__ == "__main__":

# python jpeg_hcat.py title a.jpg b.jpg c.jpg --p="hcat"

# 接收所有输入的参数并打印
# print(sys.argv[1:])

# 创建 ArgumentParser 对象
parser = argparse.ArgumentParser(description="示例程序")

# 添加 --type 参数
parser.add_argument(
"--type",
type=str,
default="hcat",
choices=["hcat", "vcat", "grid"],
help="操作类型",
)
# 添加 --cols 参数
parser.add_argument(
"--cols",
type=int,
default=3,
help="列数",
)
# 添加 --name 参数
parser.add_argument(
"--name",
type=str,
default="image",
help="输出文件名",
)
# 添加 --cols 参数
parser.add_argument(
"--author",
type=str,
default="",
help="输出作者",
)
parser.add_argument("files", nargs="+", type=str, help="输入的文件列表")
# 解析命令行参数
args = parser.parse_args()
process = args.type
files = []
name = args.name

# 接收所有输入的参数并检查参数是否包含文件
for file in args.files:
# 检查文件是否存在
temp = file.lower()
if os.path.exists(file) and os.path.isfile(file):
if temp.endswith(".jpg") or temp.endswith(".jpeg") or temp.endswith(".png"):
# 将文件名转为小写后判断
files.append(file)

# 文件数量
file_len = len(files)

if file_len == 0:
print("没有文件")
exit(0)
renames = []
image = Image.open(files[0])
width, height = image.size
rows = file_len
if process == "grid":
if rows < args.cols:
process = "hcat"
else:
# 计算行数
rows_sqrt = int(rows**0.5)
cols = rows_sqrt
if rows_sqrt > 5:
cols = 5
rows = file_len // 5
else:
cols = rows_sqrt
rows = rows_sqrt
if cols * rows < file_len:
for i in [4, 3, 2]:
n = file_len // i
if n * i == file_len:
rows = n
cols = i
break
process = f"grid {cols}"
pattern = r"(\d)x(\d)"
matrix = re.findall(pattern, args.author)
if matrix and len(matrix) == 1:
cols = int(matrix[0][0])
rows = int(matrix[0][1])
miss = cols * rows - file_len
if miss > 0:
# 补齐
id = ", ".join(["id"] * file_len)
process = f"[{id}, (new {width} {height} (255, 255, 255) > DUP {miss-1})] > grid {cols}"

# 获取文件拓展名
ext = os.path.splitext(files[0])[1]

# 使用第一文件路径作为输出文件路径,并使用 name 作为文件名
name = name + ext
output = os.path.join(os.path.dirname(files[0]), name)
target = f'"{output}"'
# 将 files 格式化为字符串,以空格分隔,使用引号将文件名括起来
quoted_files = ['"{}"'.format(file) for file in files]
input = " ".join(quoted_files)

# 运行命令
cmd = f'imagecli.exe -i {input} -o {target} -p "{process} {rows}"'
# os.system(cmd)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode == 0:
# 打开图片
# 1. 检查图片是否存在
if os.path.exists(output):
# 2. 打开图片
os.startfile(output)

# 接收所有输入的参数并保存到指定文件中
out = "D:\Program Files\clawPDF\scripts\log.txt"
with open(out, "w") as f:
f.write(cmd + "\n")

```
安卓的操作更符合直觉,完全遵循了 「指示 - 跟随」 这一原则。页面左上角的返回图标指明滑动方向,用户只需要按照相同的方向滑动操作即可完成返回操作。这和常见的交通标识的指示作用是一致的。而 iOS 则会令人疑惑,明明你指示是向左,但是实际操作却是向右。
34 天前
回复了 caizhenbin 创建的主题 程序员 哪个开源模型最擅长翻译?
多找几份你感兴趣的招聘岗位,然后对招聘要求来写,要什么你就写什么(先让 hr 感觉你合适)。然后再写些的你项目经验(让面你的人了解你)
44 天前
回复了 5261 创建的主题 Rust Rust 两次入门后,尝试写一个 web 项目,懵逼中~
sea-orm 用着难受是没有结合自定义宏一起使用,sea-orm + validator + serder-aux 前端配合 ts 的 interface 不比 java 的 MyBatis 好上百倍
55 天前
回复了 a33291 创建的主题 问与答 有用 acdsee 的用户吗?
可以看下 Lightedium, 微软商城上的版本现在有点问题,新版本正在审核,直接在官网下载,邮件备注 v2ex,给你免费 1 年。晚些时候我再发些微软商城的兑换码。
当你玩的东西足够多了你才会发现 rust 才是唯一的真神,否则你是不需要 rust 的。
69 天前
回复了 ryougifujino 创建的主题 程序员 突然有点喜欢 Tauri 2.0 了
还有一点就是 tauri 最初的想法是为 rust 开发者提供一个好的 UI 框架,随之 tauri 的发展,现在它要的越来越多了。
69 天前
回复了 ryougifujino 创建的主题 程序员 突然有点喜欢 Tauri 2.0 了
tauri 我用的比较多,主要它做为显示界面,主要业务逻辑都放在了 rust ,兼容性问题除了 win7 需要打包附带一个 webview 之外,其他的都还好。如果指望通过 js 来实现涉及到原生操作主要功能,那确实不推荐 tauri 。tauri2 因为要兼容移动平台,所以统一要求所有的插件都要配置权限,现在弄起来很烦。
@dreamkuo 补全可以是使用自定义模型吗,还是只能使用 cursor 自己的
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   987 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 22:18 · PVG 06:18 · LAX 15:18 · JFK 18:18
Developed with CodeLauncher
♥ Do have faith in what you're doing.