tiledimage 0.2.2__py3-none-any.whl → 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tiledimage/2pngs.py +26 -0
- tiledimage/cachedimage.py +1 -4
- tiledimage/pngs2.py +23 -0
- tiledimage-0.3.1.dist-info/METADATA +23 -0
- tiledimage-0.3.1.dist-info/RECORD +10 -0
- tiledimage-0.3.1.dist-info/entry_points.txt +4 -0
- tiledimage-0.2.2.dist-info/METADATA +0 -149
- tiledimage-0.2.2.dist-info/RECORD +0 -8
- tiledimage-0.2.2.dist-info/entry_points.txt +0 -4
- {tiledimage-0.2.2.dist-info → tiledimage-0.3.1.dist-info}/WHEEL +0 -0
tiledimage/2pngs.py
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
|
3
|
+
import sys
|
4
|
+
|
5
|
+
import cv2
|
6
|
+
|
7
|
+
import tiledimage.cachedimage as ci
|
8
|
+
|
9
|
+
|
10
|
+
def main():
|
11
|
+
if len(sys.argv) not in (3, 4):
|
12
|
+
print("Convert a image to a tiled image.\n")
|
13
|
+
print("usage: pngs2 from_image to_image.pngs [tilesize]\n")
|
14
|
+
sys.exit(1)
|
15
|
+
tilesize = 64
|
16
|
+
if len(sys.argv) == 4:
|
17
|
+
tilesize = int(sys.argv[3])
|
18
|
+
image = cv2.imread(sys.argv[1])
|
19
|
+
with ci.CachedImage(
|
20
|
+
"new", dir=sys.argv[2], tilesize=(tilesize, tilesize)
|
21
|
+
) as cimage:
|
22
|
+
cimage.put_image((0, 0), image)
|
23
|
+
|
24
|
+
|
25
|
+
if __name__ == "__main__":
|
26
|
+
main()
|
tiledimage/cachedimage.py
CHANGED
tiledimage/pngs2.py
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
|
3
|
+
from __future__ import print_function
|
4
|
+
|
5
|
+
import sys
|
6
|
+
|
7
|
+
import cv2
|
8
|
+
|
9
|
+
import tiledimage.cachedimage as ci
|
10
|
+
|
11
|
+
|
12
|
+
def main():
|
13
|
+
if len(sys.argv) != 3:
|
14
|
+
print("Convert an image tile to a single image.\n")
|
15
|
+
print("usage: pngs2 from_image.pngs to_image.[jpg|png|...]\n")
|
16
|
+
sys.exit(1)
|
17
|
+
with ci.CachedImage("inherit", dir=sys.argv[1]) as image:
|
18
|
+
image = image.get_image()
|
19
|
+
cv2.imwrite(sys.argv[2], image)
|
20
|
+
|
21
|
+
|
22
|
+
if __name__ == "__main__":
|
23
|
+
main()
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: tiledimage
|
3
|
+
Version: 0.3.1
|
4
|
+
Summary: tools for tiled image that can be cached on a filesystem.
|
5
|
+
License: MIT
|
6
|
+
Author: vitroid
|
7
|
+
Author-email: vitroid@gmail.com
|
8
|
+
Requires-Python: >=3.10,<4.0
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
14
|
+
Requires-Dist: opencv-python-headless (>=4.11.0.86,<5.0.0.0)
|
15
|
+
Requires-Dist: pylru (>=1.2.1,<2.0.0)
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
|
18
|
+
#TiledImage
|
19
|
+
This provides tools for tiled image that can be cached on a filesystem.
|
20
|
+
|
21
|
+
It is developed to reduce the memory usage when handling an image that is too huge to show all at a time.
|
22
|
+
It is developed for the [TrainScanner](https://github.com/vitroid/TrainScanner).
|
23
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
tiledimage/2pngs.py,sha256=J0jWP4Dx0Y3abSDG3FbAwg7kOrOZ7k3VPkx7lnt0Gt8,575
|
2
|
+
tiledimage/__init__.py,sha256=rnObPjuBcEStqSO0S6gsdS_ot8ITOQjVj_-P1LUUYpg,22
|
3
|
+
tiledimage/cachedimage.py,sha256=oXj7WeSm0OWWof1NN55ch2HBFaQ0iDM3-oqHlLItP5M,3136
|
4
|
+
tiledimage/pngs2.py,sha256=fLet08S7RAuLq-B8eqe8FvjICUKU_nL-cdYZnL9MlAw,490
|
5
|
+
tiledimage/tilecache.py,sha256=gl1kzUJUfipS7tzfWoCxktFrvb5jsXoe2p24zYwh068,3413
|
6
|
+
tiledimage/tiledimage.py,sha256=UslrUDLJlCapQRmcVmUMsCsnqY4jbmNk0tkLCpl0_SY,5823
|
7
|
+
tiledimage-0.3.1.dist-info/METADATA,sha256=WGPgD7rbC5if-2vfuB03fwqzekSeavjQnK-iSY37Rf0,876
|
8
|
+
tiledimage-0.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
9
|
+
tiledimage-0.3.1.dist-info/entry_points.txt,sha256=Ef5N7paIPCI141ygjQJ7aLN_rFHLIMjss2P-wT7xqPg,75
|
10
|
+
tiledimage-0.3.1.dist-info/RECORD,,
|
@@ -1,149 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: tiledimage
|
3
|
-
Version: 0.2.2
|
4
|
-
Summary: tools for tiled image that can be cached on a filesystem.
|
5
|
-
License: MIT
|
6
|
-
Author: vitroid
|
7
|
-
Author-email: vitroid@gmail.com
|
8
|
-
Requires-Python: >=3.10,<4.0
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
14
|
-
Requires-Dist: opencv-python-headless (>=4.11.0.86,<5.0.0.0)
|
15
|
-
Requires-Dist: pylru (>=1.2.1,<2.0.0)
|
16
|
-
Description-Content-Type: text/markdown
|
17
|
-
|
18
|
-
# TiledImage
|
19
|
-
|
20
|
-
大きな画像を効率的に扱うための Python ライブラリです。メモリ使用量を抑えながら、大きな画像をタイル(小さな断片)に分割して管理します。
|
21
|
-
|
22
|
-
## 特徴
|
23
|
-
|
24
|
-
- 大きな画像をタイルに分割して管理
|
25
|
-
- ファイルシステム上でのキャッシュ機能
|
26
|
-
- メモリ効率の良い画像処理
|
27
|
-
- コンテキストマネージャ(`with`文)による簡単な使用
|
28
|
-
|
29
|
-
## インストール
|
30
|
-
|
31
|
-
```bash
|
32
|
-
pip install tiledimage
|
33
|
-
```
|
34
|
-
|
35
|
-
## 基本的な使い方
|
36
|
-
|
37
|
-
### 画像の分割(PNG → PNGs)
|
38
|
-
|
39
|
-
```python
|
40
|
-
from tiledimage import CachedImage
|
41
|
-
import cv2
|
42
|
-
|
43
|
-
# 画像を読み込み
|
44
|
-
img = cv2.imread("large_image.png")
|
45
|
-
|
46
|
-
# タイル化して保存
|
47
|
-
with CachedImage(
|
48
|
-
mode="new",
|
49
|
-
dir="output.pngs",
|
50
|
-
tilesize=(64, 64),
|
51
|
-
cachesize=10,
|
52
|
-
bgcolor=(255, 255, 255), # 背景色(白)
|
53
|
-
fileext="jpg"
|
54
|
-
) as tiled:
|
55
|
-
tiled.put_image((0, 0), img) # 画像を配置
|
56
|
-
```
|
57
|
-
|
58
|
-
### 画像の結合(PNGs → PNG)
|
59
|
-
|
60
|
-
```python
|
61
|
-
from tiledimage import CachedImage
|
62
|
-
import cv2
|
63
|
-
|
64
|
-
# タイル化された画像を読み込み
|
65
|
-
with CachedImage(mode="inherit", dir="input.pngs") as tiled:
|
66
|
-
# 全体の画像を取得
|
67
|
-
full_image = tiled.get_image()
|
68
|
-
# 保存
|
69
|
-
cv2.imwrite("combined_image.png", full_image)
|
70
|
-
```
|
71
|
-
|
72
|
-
### コマンドラインツール
|
73
|
-
|
74
|
-
画像の分割:
|
75
|
-
|
76
|
-
```bash
|
77
|
-
pngs2 input.png output.pngs
|
78
|
-
```
|
79
|
-
|
80
|
-
画像の結合:
|
81
|
-
|
82
|
-
```bash
|
83
|
-
2pngs input.pngs output.png
|
84
|
-
```
|
85
|
-
|
86
|
-
## API リファレンス
|
87
|
-
|
88
|
-
### CachedImage
|
89
|
-
|
90
|
-
メインのクラス。タイル化された画像を管理します。
|
91
|
-
|
92
|
-
```python
|
93
|
-
CachedImage(
|
94
|
-
mode, # "new" または "inherit"
|
95
|
-
dir="image.pngs", # タイルの保存ディレクトリ
|
96
|
-
tilesize=128, # タイルのサイズ(整数またはタプル)
|
97
|
-
cachesize=10, # キャッシュサイズ
|
98
|
-
fileext="png", # タイルのファイル形式
|
99
|
-
bgcolor=(0,0,0), # 背景色
|
100
|
-
hook=None, # タイル書き換え時のフック関数
|
101
|
-
disposal=False # 終了時にディレクトリを削除するか
|
102
|
-
)
|
103
|
-
```
|
104
|
-
|
105
|
-
#### 主要メソッド
|
106
|
-
|
107
|
-
- `put_image(pos, img, linear_alpha=None)`: 画像を配置
|
108
|
-
- `get_image()`: 全体の画像を取得
|
109
|
-
- `write_info()`: 情報を保存(通常は自動的に呼ばれる)
|
110
|
-
|
111
|
-
### TiledImage
|
112
|
-
|
113
|
-
基本的なタイル画像クラス。キャッシュ機能はありません。
|
114
|
-
|
115
|
-
```python
|
116
|
-
TiledImage(
|
117
|
-
tilesize=128, # タイルのサイズ
|
118
|
-
bgcolor=(100,100,100) # 背景色
|
119
|
-
)
|
120
|
-
```
|
121
|
-
|
122
|
-
## 開発者向け情報
|
123
|
-
|
124
|
-
### テスト
|
125
|
-
|
126
|
-
```bash
|
127
|
-
make test
|
128
|
-
```
|
129
|
-
|
130
|
-
### ビルド
|
131
|
-
|
132
|
-
```bash
|
133
|
-
make build
|
134
|
-
```
|
135
|
-
|
136
|
-
### デプロイ
|
137
|
-
|
138
|
-
```bash
|
139
|
-
make deploy
|
140
|
-
```
|
141
|
-
|
142
|
-
## ライセンス
|
143
|
-
|
144
|
-
MIT License
|
145
|
-
|
146
|
-
## 作者
|
147
|
-
|
148
|
-
Masakazu Matsumoto (vitroid@gmail.com)
|
149
|
-
|
@@ -1,8 +0,0 @@
|
|
1
|
-
tiledimage/__init__.py,sha256=rnObPjuBcEStqSO0S6gsdS_ot8ITOQjVj_-P1LUUYpg,22
|
2
|
-
tiledimage/cachedimage.py,sha256=Mbxpl56dZTYiUENnqO7F6pI-0q5wvbsyUt0Gq0Z8j94,3239
|
3
|
-
tiledimage/tilecache.py,sha256=gl1kzUJUfipS7tzfWoCxktFrvb5jsXoe2p24zYwh068,3413
|
4
|
-
tiledimage/tiledimage.py,sha256=UslrUDLJlCapQRmcVmUMsCsnqY4jbmNk0tkLCpl0_SY,5823
|
5
|
-
tiledimage-0.2.2.dist-info/METADATA,sha256=rk4PgnVqkloPBubtPBLnwZ9l17fdHyYr7rxniEPKtp8,3292
|
6
|
-
tiledimage-0.2.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
7
|
-
tiledimage-0.2.2.dist-info/entry_points.txt,sha256=RiJU6UjfqclD9HizScQ4nX6PbysR7Tybr2DrKv0AXTQ,53
|
8
|
-
tiledimage-0.2.2.dist-info/RECORD,,
|
File without changes
|