当前位置: 动力学知识库 > 问答 > 编程问答 >

html - To view Tiff image on web and do image processing on it using java applet

问题描述:

I want to browse and display big Tiff image on web using HTML and Javascript and do image processing on it using java applet.

All the image loading and processing should be on client machine.

For viewing of image I want to use HTML and Javascript.

For image processing I want to use java applet.

网友答案:

i have face same prob as u face. As we all know that tiff image can't be visible on web browser. so we have to convert into Png or any other format.

File file = new File(path_of_tiff_file, name_of_tiff_file);
String newName = file.getName();
// if (!file.exists()) {
        item.write(file);
        if(item.getName().toLowerCase().indexOf(".tif") >=0 || item.getName().toLowerCase().indexOf(".tiff") >=0 ){

                            newName =item.getName().subSequence(0, item.getName().lastIndexOf(".")) + ".png";
                            File newFile = new File(path , newName);
                            BufferedImage image= null;
                            try {
                                image = Sanselan.getBufferedImage(file);
                            } catch (Exception e) {
                                // TODO: handle exception
                                e.printStackTrace();
                            }
                            Sanselan.writeImage(image, newFile, ImageFormat.IMAGE_FORMAT_PNG, new Hashtable());
                        }
分享给朋友:
您可能感兴趣的文章:
随机阅读: