Documentation
¶
Overview ¶
Package image 提供反搜图片的统一原始读取入口:本地路径、HTTP(S) URL 与 stdin 流。只按 magic bytes 接受 JPEG/PNG/WEBP,保留原始字节,并在流式读取 中强制 8 MiB 上限;文件名与响应 Content-Type 只用于诊断,不作为信任依据。
Index ¶
Constants ¶
View Source
const ( StageInput = "input" StageDownload = "download" StageStatus = "status" StageFormat = "format" StageSize = "size" StageCancel = "cancel" )
错误 stage,用于区分输入、下载、状态、格式、大小与取消错误;调用方不得 把失败回退成文本搜索。
View Source
const MaxSize = 8 << 20
MaxSize 是图片字节上限:恰好 8 MiB 合法,读到第 8 MiB 后的第一个字节 立即返回明确错误。
Variables ¶
This section is empty.
Functions ¶
func DetectHeaderSize ¶
func DetectHeaderSize() int
DetectHeaderSize 返回识别全部支持格式所需的最小 magic 字节数(WEBP 12 字节)。
Types ¶
type Format ¶
type Format int
Format 是支持的图片格式。
func DetectFormat ¶
DetectFormat 按开头字节判定图片格式;至少需要对应格式的完整 magic。
Click to show internal directories.
Click to hide internal directories.