|
@@ -37,6 +37,7 @@ import java.util.zip.ZipEntry;
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
import com.drew.metadata.MetadataException;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
/**
|
|
|
* 通用工具类
|
|
@@ -626,4 +627,21 @@ public class CommonUtil {
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * webp文件转字节数组
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static byte[] webpToPngBytes(InputStream inputStream) {
|
|
|
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
+ try {
|
|
|
+ BufferedImage webpImage = ImageIO.read(inputStream);
|
|
|
+ ImageIO.write(webpImage,"png",bos);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return bos.toByteArray();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|