(ImagePlus imp, String path)
| 61 | } |
| 62 | |
| 63 | void writeImage(ImagePlus imp, String path) throws Exception { |
| 64 | if(imp.getBitDepth()==24) |
| 65 | biBitCount = 24; |
| 66 | else { |
| 67 | biBitCount = 8; |
| 68 | LookUpTable lut = imp.createLut(); |
| 69 | biClrUsed=lut.getMapSize(); // 8 bit color image may use less |
| 70 | bfOffBits+=biClrUsed*4; |
| 71 | } |
| 72 | if (path==null || path.equals("")) { |
| 73 | String prompt = "Save as " + biBitCount + " bit BMP"; |
| 74 | SaveDialog sd = new SaveDialog(prompt, imp.getTitle(), ".bmp"); |
| 75 | if(sd.getFileName()==null) |
| 76 | return; |
| 77 | path = sd.getDirectory()+sd.getFileName(); |
| 78 | } |
| 79 | imp.startTiming(); |
| 80 | saveBitmap (path, imp.getImage(), imp.getWidth(), imp.getHeight() ); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | public void saveBitmap (String parFilename, Image parImage, int parWidth, int parHeight) throws Exception { |
no test coverage detected