6 Replies Latest reply on Jun 15, 2018 11:25 AM by Steven Si

    What is the B64 algorithm that accepts to print an image

    daniel Ppe

      I need your help.


      I am trying to print an image in B64, but I have not succeeded, I have read several forums and I hace not found the solution, I need to know which algorithm zpl accepts, the development i hace in Java 8.


      I only need to know what the algorithm is to convert a PNG to B64, but without using an external tool.???






      public void Converter(){

        File file = new File("/storage/sdcard0/DCIM/image.png");

        try {


         FileInputStream imageInFile = new FileInputStream(file);
        byte imageData[] = new byte[(int) file.length()];


         String imageDataString = encodeImage(imageData);
         ZCRC16 zcrc16 = new ZCRC16();
         String crc16 = zcrc16.getCRC16ForZpl(imageDataString);
        Log.d("B64 :: " + imageDataString.toString());
         Log.d("CRC :: ", crc16);

         } catch (FileNotFoundException e) {

        System.out.println("Image not found" + e);
         } catch (IOException ioe) {

        System.out.println("Exception while reading the Image " + ioe);


         public static String encodeImage(byte[] imageByteArray) {

         return Base64.encodeBytes(imageByteArray, Base64.ENCODE);