Documentation ¶
Index ¶
- Variables
- func Buffer(source_path, extension string, ...) (buffer image.Image, err error)
- func BufferSize(bufSize, tileSize int) int
- func GetLevelSize(logicWidth, logicHeight, level int) (int, int)
- func GetMatrixInfo(sourcePath string) (cols, rows, blockWidth, blockHeight, logicWidth, logicHeight int, ...)
- func GetMaxLevel(width, height int) (max_level int)
- func GetTileRect(width, height, col, row, tileSize int) (left, top, right, bottom int)
- func Info(path string) (width, height int, err error)
- func Load(img_path string) (img image.Image, err error)
- func Matrix(sourcePath, targetPath string, bufSize, tileSize, threadPool int)
- func Max(a, b int) int
- func MergeFiles(source_path string) image.Image
- func Min(a, b int) int
- func Resize(source_path, target_path string, scale float64) error
- func ResizeImage(source image.Image, scale float64) (target image.Image)
- func Save(img_path string, img image.Image) (err error)
- func SaveTiles(targetPath string, tiles [][]image.Image, tileSize, x, y int) (err error)
- func Single(sourceFilePath, targetPath string, tileSize int) (err error)
- func Tile(src image.Image, tileSize int) (dst [][]image.Image)
Constants ¶
This section is empty.
Variables ¶
View Source
var ThreadPool = 100
Functions ¶
func Buffer ¶ added in v0.3.0
func Buffer(source_path, extension string, bufSize, logicWidth, logicHeight, blockWidth, blockHeight, left, top int) (buffer image.Image, err error)
在逻辑大图中抠一个虚拟区域
在瓦片化的多个图像文件形成的逻辑大图中, 锁定一个固定大小的虚拟区域, 进行图像提取, 提取到内存中
source_folder_path: 原图像文件夹地址 extension: 源文件的扩展名 bufSize: 虚拟区域的固定大小
blockWidth & blockHeight: 原瓦片文件的宽度与高度
startX & startY: 虚拟区域位于逻辑大图的左上角
func BufferSize ¶ added in v0.3.0
func GetLevelSize ¶ added in v0.3.0
func GetMatrixInfo ¶ added in v0.3.0
func GetMatrixInfo(sourcePath string) (cols, rows, blockWidth, blockHeight, logicWidth, logicHeight int, extension string, err error)
获取矩阵信息
params: sourcePath: 源文件路径 returns: cols: 列 rows: 行
func GetMaxLevel ¶ added in v0.3.0
func GetTileRect ¶ added in v0.3.0
计算瓦片在原始逻辑图像中的坐标 params:
width: 逻辑图宽度 height: 逻辑图高度 col: 列 (瓦片) row: 行 (瓦片) tileSize: 瓦片尺寸 (正方形)
func Matrix ¶ added in v0.3.0
Params:
sourcePath: 源文件路径 targetPath: 目标文件路径 bufSize: 缓冲区大小(2的n次方)(小于4096时默认使用4096) tileSize: 瓦片大小(正方形图片边长)(默认256)
func Resize ¶
等比例调整图片大小, 原路径替换文件
in: source_path: 源文件路径 target_path: 目标文件路径 scale: 缩放比例 (正数放大, 负数缩小) out: err example: images.Resize("image/0/a.jpg", "image/1/b.jpg", 2) // 放大一倍 images.Resize("image/0/a.jpg", "image/1/b.jpg", 0.5) // 缩小一倍
func ResizeImage ¶ added in v0.2.0
重置图像大小
params: source: image.Image (输入图像) scale: 缩放比例 (>1 放大) (<1 缩小) returns: target: image.Image (输出图像)
func SaveTiles ¶ added in v0.3.0
保存瓦片到文件
input:
targetPath: 目标路径 tiles: 瓦片数组 tileSize: 瓦片尺寸 x: 位于目标逻辑大图上的横向坐标 y: 位于目标逻辑大图上的纵向坐标
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.