MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / writeImage

Method writeImage

ij/src/main/java/ij/plugin/BMP_Writer.java:63–81  ·  view source on GitHub ↗
(ImagePlus imp, String path)

Source from the content-addressed store, hash-verified

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 {

Callers 1

runMethod · 0.95

Calls 12

getMapSizeMethod · 0.95
getFileNameMethod · 0.95
getDirectoryMethod · 0.95
saveBitmapMethod · 0.95
createLutMethod · 0.80
startTimingMethod · 0.80
getTitleMethod · 0.65
getImageMethod · 0.65
getBitDepthMethod · 0.45
equalsMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected