imageutil

package
v0.0.0-...-5d3bb56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package imageutil provides image processing utilities for OCR.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDimensions

func GetDimensions(path string) (int, int, error)

GetDimensions returns the width and height of an image file.

func SaveSlices

func SaveSlices(slices []Slice, imagePath string, maxHeight, overlap int) (string, error)

SaveSlices writes slices to a subdirectory next to the original image. The directory is named after the image file (without extension). Files are named 001.jpg, 002.jpg, etc. Returns the directory path.

Types

type Slice

type Slice struct {
	Data   []byte // JPEG-encoded bytes
	Y      int    // Y offset of this slice in the original image
	Height int    // height of this slice (before encoding)
}

Slice represents one horizontal strip of a sliced image.

func SliceImage

func SliceImage(path string, maxHeight, overlap int) ([]Slice, int, int, error)

SliceImage splits an image into overlapping horizontal strips. maxHeight is the maximum height of each slice in pixels. overlap is the vertical overlap between consecutive slices in pixels.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL