middle

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

README

use

pdfFile := "./pdf/test.pdf"
bmpOutPath := "./bmp"
err := middle.Pdf2Bmp(pdfFile, bmpOutPath)
if nil != err {
    fmt.Println(err)
    return
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bmp2Zpl

func Bmp2Zpl(p string, zplPath string) error

Bmp2Zpl ...

func ExtName

func ExtName(p string) string

ExtName 提取文件的名字

func GrayImag

func GrayImag(src image.Image) image.Image

GrayImag 将原图数据转成灰度数据

func Pdf2Bmp

func Pdf2Bmp(pdfPath string, bmpPath string, n ...string) error

Pdf2Bmp 将pdf转成位图,pdfPath:pdf所在路径,bmpPath:生成的bmp图像所在路径 eg: Pdf2Bmp("./test.pdf", "./bmp")

Types

type BMP

type BMP struct {
	Head       BMPHead
	Info       BMPInfo
	ColorTable []BMPColorTable
	Data       []byte
}

BMP ...

func ReadBMP

func ReadBMP(p string) (*BMP, error)

ReadBMP 读取bmp图片

func (BMP) String

func (my BMP) String() string

func (*BMP) ToGray

func (my *BMP) ToGray() error

ToGray ...

type BMPColorTable

type BMPColorTable struct {
	Red      uint8
	Green    uint8
	Blue     uint8
	Reserved uint8
}

BMPColorTable 4B

type BMPHead

type BMPHead struct {
	Type   [2]byte //2B type:BM(default)
	Size   uint32  //4B bmp file size
	R1     uint16  //2B reserve
	R2     uint16  //2B reserve
	Offset uint32  //4B start address
}

BMPHead 14B

type BMPInfo

type BMPInfo struct {
	Size            uint32 //4B struct size
	Width           int32  //4B horizontal width of bitmap in pixels
	Height          int32  //4B vertical height of bitmap in pixels
	Planes          uint16 //2B number of planes
	BitPerPixel     uint16 //2B 1,4,8,16,24----
	Compression     uint32 //4B 0 no compression, 1 8bit RLE encoding, 2 4bit RLE encoding
	ImageSize       uint32 //4B siez of image if Compression =0 it is valid to set 0
	XpixelsPerM     uint32 //4B horizontal resolution:pixels/meter
	YpixelsPerM     uint32 //4B vertical resolution
	ColorUsed       uint32 //4B number of actually used colors
	ImportantColors uint32 //4B
}

BMPInfo 40B

Jump to

Keyboard shortcuts

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