MATLAB Answers


Change the intensity of blue in a .jpg

Asked by Billy
on 20 Nov 2012

Hello, how do I change the blue intensity of a .jpg so that the new image is combination of rg and the new b. Thanks.


1 Answer

Answer by Image Analyst
on 20 Nov 2012
 Accepted answer
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now change the blue channel in whatever way you want.
blueChannel = whatever.........
% Then recombine into the new color image.
rgbImage = cat(3, redChannel, greenChannel, blueChannel);


on 20 Nov 2012

Oh the IM is the same as this rgbImage. Thank you very much to the both of you, sorry for being redundant. One last question. How do I display this new image, I am not sure how I piece together your answer and the one I received here. Thanks again.

Image Analyst
on 20 Nov 2012
blueChannel = uint8(single(blueChannel) + 255*BX/100);

Then recombine and show the final image:

on 20 Nov 2012

Thank You VERY Much. That saved a lot of headache.

Discover MakerZone

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

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!