golang处理TIFF

1 标准TIFF

  1. 引入仓库
go get https://github.com/cognusion/imaging
  1. 简介
  • 虽然该仓库停止维护了5年了,但是它拥有出色的处理能力,支持jpg\jpeg\png\gift\tiff,是对image包的功能拓展。
  • 只要按照image包的格式,且返回指定的结构体,注册自定义图片类型的DecoderEncoder,即可完成自己的图片处理。
  1. 不足
    它只能处理标准格式的tiff(特征码II*),不能处理BigTiff(特征码II+

2 拓展型BigTiff、GeoTiff

针对imaging无法处理BigTiff、GeoTiff的情况,需要引入其它的仓库:返回的格式需为image的图像结构体;有对应的DecodeDecodeConfigEncode

  1. 引入仓库
go get https://github.com/chai2010/tiff
  1. 在处理图片前,注册类型处理
// 文件后缀、特征码、解码器、解码配置
image.RegisterFormat("tiff", "II+", tiff.Decode, tiff.DecodeConfig)
请继续 ifeq ($(GO_TARGET_SPECTRE_SUPPORTED),1) PKG_CONFIG_DEPENDS+=CONFIG_GOLANG_SPECTRE endif define Package/golang/Default $(call GoPackage/GoSubMenu) TITLE:=Go programming language URL:=https://go.dev/ DEPENDS:=$(GO_ARCH_DEPENDS) endef define Package/golang/Default/description The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language. endef # go tool requires source present: # https://github.com/golang/go/issues/4635 define Package/golang $(call Package/golang/Default) TITLE+= (compiler) DEPENDS+= +golang-src endef define Package/golang/description $(call Package/golang/Default/description) This package provides an assembler, compiler, linker, and compiled libraries for the Go programming language. endef define Package/golang/config source "$(SOURCE)/Config.in" endef define Package/golang-doc $(call Package/golang/Default) TITLE+= (documentation) endef define Package/golang-doc/description $(call Package/golang/Default/description) This package provides the documentation for the Go programming language. endef define Package/golang-src $(call Package/golang/Default) TITLE+= (source files) DEPENDS+= +libstdcpp +libtiff endef define Package/golang-src/description $(call Package/golang/Default/description) This package provides the Go programming language source files needed for cross-compilation. endef
最新发布
09-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值