MCPcopy Create free account
hub / github.com/skip2/go-qrcode / WriteFile

Method WriteFile

qrcode.go:376–386  ·  view source on GitHub ↗

WriteFile writes the QR Code as a PNG image to the specified file. size is both the image width and height in pixels. If size is too small then a larger image is silently written. Negative values for size cause a variable sized image to be written: See the documentation for Image().

(size int, filename string)

Source from the content-addressed store, hash-verified

374// a larger image is silently written. Negative values for size cause a
375// variable sized image to be written: See the documentation for Image().
376func (q *QRCode) WriteFile(size int, filename string) error {
377 var png []byte
378
379 png, err := q.PNG(size)
380
381 if err != nil {
382 return err
383 }
384
385 return ioutil.WriteFile(filename, png, os.FileMode(0644))
386}
387
388// encode completes the steps required to encode the QR Code. These include
389// adding the terminator bits and padding, splitting the data into blocks and

Callers 4

WriteFileFunction · 0.95
WriteColorFileFunction · 0.95
zbarimgCheckFunction · 0.80

Calls 1

PNGMethod · 0.95

Tested by 2

zbarimgCheckFunction · 0.64