BufferedImage转换InputStream

            BufferedImage bi = (BufferedImage) dicom.getImage();
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            String imagePath = format + ".jpg";
            ImageIO.write(bi, "jpg", os);
            // ImageIO.write(bi, "jpg", new File(imagePath));
            //   File file = new File(imagePath);
            //  inputStream = new FileInputStream(file);
            inputStream = new ByteArrayInputStream(os.toByteArray());

你可能感兴趣的:(java,大数据,开发语言)