Clear Filters
Clear Filters

Increase the brightness of an image

11 views (last 30 days)
Rachel Barbera
Rachel Barbera on 16 Nov 2017
Answered: DGM on 19 Apr 2022
Hi all, I am trying to increase the brightness of an image by adding 100 to each pixel value. Can I know what's the code and step for it?

Accepted Answer

KSSV
KSSV on 16 Nov 2017
I = imread('peppers.png') ;
I1 = I+100 ;
imshow(I1) ;

More Answers (1)

DGM
DGM on 19 Apr 2022
While simple addition is probably the best answer, there are also various tools that may be used to accomplish simple adjustment of brightness and related image properties. Tools like imadjust() can accomplish the same goal, and might offer some convenience in that they're class-agnostic and have the capacity to simultaneously do other tasks.
% a linear series (placeholder for an image)
A = uint8(linspace(0,255,100));
% demonstrate that imadjust can be used for purely additive adjustment
db = 100; % amount to increase brightness
B = imadjust(A,[0 255-db]/255,[db 255]/255);
plot(A,B)
axis equal
xlim([0 255])
ylim([0 255])
% but it can also be used for combined brightness/contrast adjustment
C = imadjust(A,[0 145]/255,[50 255]/255);
plot(A,C)
axis equal
xlim([0 255])
ylim([0 255])
Whether the added complexity of using purpose-built adjustment tools is warranted is a decision I'll leave to the reader.
The following (nearly identical) question includes an answer that attempts to review the options available in IPT and MIMT:

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!