繁体   English   中英

在 Web 上查看 Tiff 图像并使用 Java 小程序对其进行图像处理

[英]To view Tiff image on web and do image processing on it using java applet

我想使用 HTML 和 Javascript 在网络上浏览和显示大 Ti​​ff 图像,并使用 java applet 对其进行图像处理。

所有的图像加载和处理都应该在客户端机器上。 为了查看图像,我想使用 HTML 和 Javascript。

对于图像处理,我想使用 java applet。

我和你面临同样的问题。 众所周知,tiff 图像在网络浏览器上是不可见的。 所以我们必须转换成 Png 或任何其他格式。

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());
                        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM