MATLAB Answers

## decreasing number of gray levels in a image

Asked by k.v.swamy

### k.v.swamy (view profile)

on 30 Nov 2012

hi all, can any one tell me how to decrease the no of gray levels in a image.i have to decrease in the powers of 2. regards k.v.swamy.

## 1 Answer

### Image Analyst (view profile)

Answer by Image Analyst

### Image Analyst (view profile)

on 30 Nov 2012

Perhaps I don't understand what you want, but why can't you simply divide the image by 2, 4, 8, or whatever power of 2 you want? For examples:

```reducedGrayLevelsImage = originalGrayImage / 8;
reducedGrayLevelsImage = originalGrayImage / 16;
reducedGrayLevelsImage = originalGrayImage / 4;
```

Is that all you're looking for? Or is it more complicated than that? If so, explain the nuances that I've overlooked.

#### Join the 15-year community celebration.

Play games and win prizes!

Learn more

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

### MATLAB Academy

New to MATLAB?

Learn MATLAB today!