我從服務器端以base64格式獲得jp2。我能夠將jpg轉換爲ImageMagick庫的jp2併發送到服務器。他們可以使用緩衝圖像和ImageIo將其轉換爲jpg。 但我沒有得到任何想法將jp2轉換爲jpg並在Imageview中呈現。 希望得到任何幫助。提前致謝。將jp2(jpeg2000)渲染爲android中的Imageview。
0
A
回答
-1
從https://stackoverflow.com/a/39103107/2760681
private static void convertImage(int randNum) throws IOException {
try {
File foundFile = new File("c:\\images\\" + randNum + ".jp2");
BufferedImage background = ImageIO.read(foundFile);
ImageIO.write(background, "jpg", new File("c:\\images\\" + randNum + ".jpg"));
System.out.println("jpg file is generated");
} catch (Exception e) {
// TODO: handle exception
System.out.println("No file " + randNum +".jp2 found");
}
}
0
試試這個代碼,你可以使用OpenJpeg庫解碼JPEG2000。您可以使用編譯庫https://github.com/DimaArts/OpenJpegAndroid。它包含一個編碼jpeg2000的例子。庫支持解碼器和編碼器的PNG輸入和輸出格式。 試試這個:
OpenJPEGJavaDecoder decoder = new OpenJPEGJavaDecoder();
String[] params2 = new String[4];
params2[0] = "-i";
params2[1] = mInputPath; // path to jp2
params2[2] = "-o";
params2[3] = mOutputPath // path to png
decoder.decodeJ2KtoImage(params2);
如果您正在使用JNI:
public int decodeJ2KtoImage(String[] parameters) {
return internalDecodeJ2KtoImage(parameters);
}
相關問題
- 1. 壓縮JP2(JPEG2000)圖像
- 2. mupdf渲染jpeg2000失去顏色?
- 3. 如何在picturebox中顯示JPEG2000圖像(* .jp2)
- 4. 在Android中ImageView中渲染兩個圖像?
- 5. Android中的PDF渲染
- 6. PDF在android中的渲染
- 7. 將CATransformLayer渲染爲3D中的PNG
- 8. Android PDF渲染
- 9. MathJax渲染Android
- 10. 渲染Android Studio
- 11. 將Html渲染爲圖像
- 12. 將標記渲染爲雲
- 13. 將C#類渲染爲javascript
- 14. 將LaTeX渲染爲圖像
- 15. 將HTML渲染爲圖像
- 16. iOS:將UITableView渲染爲PDF
- 17. 將文本渲染爲LPDIRECT3DTEXTURE9
- 18. 將SurfaceTexture渲染爲Unity Texture2D
- 19. 將Maquette渲染爲HTML
- 20. 將jinja2塊渲染爲json
- 21. 將CGImageRef另存爲JPEG2000
- 22. 將jp2的byte []轉換爲jpg文件
- 23. Android Studio中渲染庫
- 24. Android Studio中,渲染問題
- 25. 渲染錯誤Android Studio中
- 26. 將根渲染爲null(在DOMless範圍內渲染)
- 27. 將渲染對象渲染爲React組件
- 28. Android文字渲染
- 29. Android-圖像渲染
- 30. 將ipcam-view流渲染成SurfaceTexture -Android
感謝烏拉圭回合答覆..但是BufferedImage的和ImageIO的不Android SDK中支持。所以,請讓我知道任何替代品 – Jeethendra