Get image from the path. If it is in a zip file, it will open the zip
(String path)
| 859 | * Get image from the path. If it is in a zip file, it will open the zip |
| 860 | */ |
| 861 | @AstroImageJ(reason = "Open zip of pngs as folder") |
| 862 | private static BufferedImage getImageFromPath(String path) throws IOException { |
| 863 | if (path.contains(".zip")) { |
| 864 | var s = path.split("\\.zip"); |
| 865 | var zip = new ZipFile(s[0] + ".zip"); |
| 866 | |
| 867 | var img = ImageIO.read(zip.getInputStream(zip.getEntry(s[1].substring(1)))); |
| 868 | zip.close(); |
| 869 | return img; |
| 870 | } |
| 871 | return ImageIO.read(new File(path)); |
| 872 | } |
| 873 | |
| 874 | /** Converts the specified RGB image to 8-bits if the 3 channels are identical. */ |
| 875 | public static void convertGrayJpegTo8Bits(ImagePlus imp) { |
no test coverage detected