Documentation ¶
Index ¶
- Constants
- Variables
- func Barcode(value string) ([]byte, error)
- func ClipperRectangle(file multipart.File, x1, y1, x2, y2 int) (outByte []byte, err error)
- func ClipperRound(file multipart.File, x, y, r int) (outByte []byte, err error)
- func CompositeGif(file []*multipart.FileHeader) (outByte []byte, err error)
- func FontTTFInit()
- func ImageResize(src image.Image, w, h int) image.Image
- func Img2Txt(file multipart.File) (outByte []byte, err error)
- func ImgAlpha(file multipart.File, percentage float64) (outByte []byte, err error)
- func ImgCenter(file multipart.File) (outByte []byte, err error)
- func ImgCompress(img image.Image, width, height int, outType string) []byte
- func ImgGray(file multipart.File) (outByte []byte, err error)
- func ImgInvert(file multipart.File) (outByte []byte, err error)
- func ImgStitching(fileList []multipart.File) (outByte []byte, err error)
- func ImgStitchingParallel()
- func ImgStitchingSudoku(fileList []multipart.File) (outByte []byte, err error)
- func PrintIFD(ifds []IfdEntries)
- func QRCodeRecognition()
- func QrCodeBase64(value string) ([]byte, error)
- func Revolve(file multipart.File, revolveType string) (outByte []byte, err error)
- func Txt2Img(txt string, fontSize, dpi, spacing int, outType string) (outByte []byte, err error)
- func WatermarkLogo(imgFile, logoFile multipart.File) (outByte []byte, err error)
- func WatermarkTxt(file multipart.File, txt, color string, fontSize, dpi, position int) (outByte []byte, err error)
- type ExifData
- type ExifInterface
- type IfdEntries
- type TiffData
- func (ex TiffData) GetFirstIFD() uint32
- func (ex TiffData) GetIFDList() []uint32
- func (ex TiffData) GetNextIFD(ifdOffset uint32) uint32
- func (ex *TiffData) Int16() int16
- func (ex *TiffData) Int32() int32
- func (ex *TiffData) Int64() int64
- func (ex TiffData) ProcessIFD(ifdSeq uint8, ifdOffset uint32, tagDict map[uint16]string) []IfdEntries
- func (ex *TiffData) SetByteOrder(byteorder string)
- func (ex *TiffData) SetData(data []byte)
- func (ex *TiffData) Slice(offset uint32, length uint32) *TiffData
- func (ex *TiffData) Uint16() uint16
- func (ex *TiffData) Uint32() uint32
- func (ex *TiffData) Uint64() uint64
- type TiffInterface
Constants ¶
const EXIF_GPSINFO_TAG = 0x8825 // GPSInfo
const EXIF_HEADER_READ_SIZE = 12
const EXIF_IOP_TAG = 0xa005 // ExifInteroperabilityOffset
const EXIF_SUBIFD_OFFSET_TAG = 0x8769 // SubIFD
Variables ¶
var EXIF_GPSINFO_TAGS = map[uint16]string{
0x0000: "GPSVersionID",
0x0001: "GPSLatitudeRef",
0x0002: "GPSLatitude",
0x0003: "GPSLongitudeRef",
0x0004: "GPSLongitude",
0x0005: "GPSAltitudeRef",
0x0006: "GPSAltitude",
0x0007: "GPSTimeStamp",
0x0008: "GPSSatellites",
0x0009: "GPSStatus",
0x000a: "GPSMeasureMode",
0x000b: "GPSDOP",
0x000c: "GPSSpeedRef",
0x000d: "GPSSpeed",
0x000e: "GPSTrackRef",
0x000f: "GPSTrack",
0x0010: "GPSImgDirectionRef",
0x0011: "GPSImgDirection",
0x0012: "GPSMapDatum",
0x0013: "GPSDestLatitudeRef",
0x0014: "GPSDestLatitude",
0x0015: "GPSDestLongitudeRef",
0x0016: "GPSDestLongitude",
0x0017: "GPSDestBearingRef",
0x0018: "GPSDestBearing",
0x0019: "GPSDestDistanceRef",
0x001a: "GPSDestDistance",
0x001b: "GPSProcessingMethod",
0x001c: "GPSAreaInformation",
0x001d: "GPSDateStamp",
0x001e: "GPSDifferential",
}
var EXIF_HEADER_SIGNATURE = []byte{0xff, 0xd8, 0xff, 0xe1}
var EXIF_IOP_TAGS = map[uint16]string{
0x0001: "InteroperabilityIndex",
0x0002: "InteroperabilityVersion",
0x1000: "RelatedImageFileFormat",
0x1001: "RelatedImageWidth",
0x1002: "RelatedImageLength",
}
var EXIF_TAGS = map[uint16]string{
0x0100: "ImageWidth",
0x0101: "ImageLength",
0x0102: "BitsPerSample",
0x0103: "Compression",
0x0106: "PhotometricInterpretation",
0x0111: "StripOffsets",
0x0115: "SamplesPerPixel",
0x0116: "RowsPerStrip",
0x0117: "StripByteConunts",
0x010e: "ImageDescription",
0x010f: "Make",
0x0110: "Model",
0x0112: "Orientation",
0x011a: "XResolution",
0x011b: "YResolution",
0x011c: "PlanarConfiguration",
0x0128: "ResolutionUnit",
0x0131: "Software",
0x0132: "DateTime",
0x013e: "WhitePoint",
0x013f: "PrimaryChromaticities",
0x0201: "JpegIFOffset",
0x0202: "JpegIFByteCount",
0x0211: "YCbCrCoefficients",
0x0213: "YCbCrPositioning",
0x0214: "ReferenceBlackWhite",
0x8298: "Copyright",
0x8769: "ExifOffset",
0x829a: "ExposureTime",
0x829d: "FNumber",
0x8822: "ExposureProgram",
0x8827: "ISOSpeedRatings",
0x9000: "ExifVersion",
0x9003: "DateTimeOriginal",
0x9004: "DateTimeDigitized",
0x9101: "ComponentConfiguration",
0x9102: "CompressedBitsPerPixel",
0x9201: "ShutterSpeedValue",
0x9202: "ApertureValue",
0x9203: "BrightnessValue",
0x9204: "ExposureBiasValue",
0x9205: "MaxApertureValue",
0x9206: "SubjectDistance",
0x9207: "MeteringMode",
0x9208: "LightSource",
0x9209: "Flash",
0x920a: "FocalLength",
0x927c: "MakerNote",
0x9286: "UserComment",
0xa000: "FlashPixVersion",
0xa001: "ColorSpace",
0xa002: "ExifImageWidth",
0xa003: "ExifImageHeight",
0xa004: "RelatedSoundFile",
0xa005: "ExifInteroperabilityOffset",
0xa20e: "FocalPlaneXResolution",
0xa20f: "FocalPlaneYResolution",
0xa210: "FocalPlaneResolutionUnit",
0xa217: "SensingMethod",
0xa300: "FileSource",
0xa301: "SceneType",
0xa401: "CustomRendered",
0xa402: "ExposureMode",
0xa403: "WhiteBalance",
0xa404: "DigitalZoomRatio",
0xa405: "FocalLengthIn35mmFilm",
0xa406: "SceneCaptureType",
0xa407: "GainControl",
0xa408: "Contrast",
0xa409: "Saturation",
0xa40a: "Sharpness",
0xa40b: "DeviceSettingDescription",
0xa40c: "SubjectDistanceRange",
0xa420: "ImageUniqueID",
0xa430: "CameraOwnerName",
0xa431: "BodySerialNumber",
0xa432: "LensSpecification",
0xa433: "LensMake",
0xa434: "LensModel",
0xa435: "LensSerialNumber",
}
var FormatType = map[int]string{
1: "UB",
2: "A",
3: "US",
4: "UL",
5: "UR",
6: "SB",
7: "?",
8: "SS",
9: "SL",
10: "SR",
}
var IfdSeqMap = map[uint8]string{
0: "Main",
1: "Thumbnail",
2: "SubIFD",
3: "GPSInfo",
4: "IOPInfo",
}
Functions ¶
func ClipperRectangle ¶
func ClipperRound ¶
TODO BUG
func CompositeGif ¶
func CompositeGif(file []*multipart.FileHeader) (outByte []byte, err error)
func FontTTFInit ¶
func FontTTFInit()
func ImgCompress ¶
// Nearest-neighbor interpolation
NearestNeighbor InterpolationFunction = iota // Bilinear interpolation Bilinear // Bicubic interpolation (with cubic hermite spline) Bicubic // Mitchell-Netravali interpolation MitchellNetravali // Lanczos interpolation (a=2) Lanczos2 // Lanczos interpolation (a=3) Lanczos3
func ImgStitching ¶
选用最大图片的宽度, 垂直依次拼接
func ImgStitchingSudoku ¶
选用最大图片宽高, 九宫格拼接
func WatermarkLogo ¶
Types ¶
type ExifData ¶
type ExifData struct { IfdData map[string][]IfdEntries // contains filtered or unexported fields }
ExifData represents a map of IfdEntries
func NewExifData ¶
func NewExifData() *ExifData
func (*ExifData) GetExifData ¶
GetExifData checks the byte stream header to match EXIF metadata and returns the EXIF data up to length defined in the header
func (*ExifData) GetTagValues ¶
type ExifInterface ¶
type ExifInterface interface { GetExifHeader(r io.Reader) (data []byte, err error) ProcessExifStream(f *os.File) (err error) GetTagValues(tag uint16) (values interface{}, ok bool) }
ExifInterface implements Exif Header retrieval and Exif stream processing
type IfdEntries ¶
IfdEntries represents EXIF metadata for specific tag
type TiffData ¶
type TiffData struct {
// contains filtered or unexported fields
}
TiffData contains the byteorder, data buffer and current slice
func (TiffData) GetFirstIFD ¶
GetFirstIFD returns the first IFD in the data
func (TiffData) GetIFDList ¶
GetIFDList returns the list of all IFDs (as offsets)
func (TiffData) GetNextIFD ¶
GetNextIFD calculates end returns offset of the next available IFD
func (*TiffData) Int16 ¶
Int16 returns 16 bit signed integer taking into consideration the endianness defined
func (*TiffData) Int32 ¶
Int32 returns 32 bit signed integer taking into consideration the endianness defined
func (*TiffData) Int64 ¶
Int64 returns 64 bit signed integer taking into consideration the endianness defined
func (TiffData) ProcessIFD ¶
func (ex TiffData) ProcessIFD(ifdSeq uint8, ifdOffset uint32, tagDict map[uint16]string) []IfdEntries
ProcessIFD takes the IFD sequence; IFD offset; EXIF tags dictionary and returns an array of IfdEntries
func (*TiffData) SetByteOrder ¶
SetByteOrder sets the byte order for the TiffData (Intel/Motorola)
func (*TiffData) Slice ¶
Slice allocates and sets TiffData.slice bases on provided offset & length returns pointer to TiffData
func (*TiffData) Uint16 ¶
Uint16 returns 16 bit unsigned integer taking into consideration the endianness defined
type TiffInterface ¶
type TiffInterface interface { SetByteOrder(byteorder string) SetData(data []byte) GetFirstIFD() uint32 GetNextIFD(ifdOffset uint32) uint32 GetIFDList() []uint32 ProcessIFD(ifdSeq uint8, ifdOffset uint32, tagDict map[uint16]string) []IfdEntries }
TiffInterface implements methods to process IFDs