Exemplo n.º 1
0
// Encodes the binary in a colorful or B/W image
func generateColorImage(imgout string, binaryArray []byte, sectionData []binanal.SectionData) error {
	encoder, binImage := image.EncodeColor(binaryArray, sectionData)

	// Write image to file
	malPict, err := os.Create(imgout + ".png")
	if err != nil {
		return err
	}
	encoder.Encode(malPict, binImage)

	return nil
}
Exemplo n.º 2
0
// Encodes the binary in a colorful or B/W image
func generateColorImage(imgout, filePath string, sectionData []binanal.SectionData) error {
	// Read file to byte array
	binaryArray, err := ioutil.ReadFile(filePath)
	if err != nil {
		return err
	}

	encoder, binImage := image.EncodeColor(binaryArray, sectionData)

	// Write image to file
	malPict, err := os.Create(imgout)
	if err != nil {
		return err
	}
	encoder.Encode(malPict, binImage)

	return nil
}