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

Method convertImage

ij/src/main/java/ij/plugin/BMP_Writer.java:127–143  ·  view source on GitHub ↗
(Image parImage, int parWidth, int parHeight)

Source from the content-addressed store, hash-verified

125 *
126 */
127 private boolean convertImage (Image parImage, int parWidth, int parHeight) {
128 int pad;
129 if(biBitCount == 24)
130 intBitmap = (int[]) imp.getProcessor().getPixels();
131 else
132 byteBitmap = (byte[]) imp.getProcessor().convertToByte(true).getPixels();
133 biWidth = parWidth;
134 biHeight = parHeight;
135 if(biBitCount==24)
136 pad = 4 - ((biWidth * 3) % 4);
137 else
138 pad = 4 - ((biWidth) % 4);
139 if (pad == 4) // <==== Bug correction
140 pad = 0; // <==== Bug correction
141 padWidth = biWidth*(biBitCount==24?3:1)+pad;
142 return (true);
143 }
144
145 /*
146 * writeBitmap converts the image returned from the pixel grabber to

Callers 1

saveMethod · 0.95

Calls 3

getPixelsMethod · 0.45
getProcessorMethod · 0.45
convertToByteMethod · 0.45

Tested by

no test coverage detected