package com.face.jsonBean;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;

public class ImgToBase64 {

    public static void main(String[] args) throws IOException {
        Path imageFile = Paths.get("F:\\体验腾讯人脸融合-素材\\222.jpg");
        byte[] imageBytes = Files.readAllBytes(imageFile);


/*
            InputStream imageInputStream = new FileInputStream("F:\\体验腾讯人脸融合-素材\\111.jpg");
            byte[] imageBytes = new byte[imageInputStream.available()];
            imageInputStream.read(imageBytes);
            imageInputStream.close();*/

        String imgBase = Base64.getEncoder().encodeToString(imageBytes);
    }
}
