How can I plot an image in matlab. This is giving me a Black png image!

139 visualizzazioni (ultimi 30 giorni)
URL =''
figure, imshow(y);
This is giving me a Black image! How can i Plot it without getting all black?

Risposta accettata

sixwwwwww il 5 Dic 2013
Modificato: sixwwwwww il 5 Dic 2013
you can do it as follows:
URL =''
filename = 'test.png'
y = imread(filename, 'BackgroundColor', [1 1 1]);
figure, imshow(y);
The problem here was to replace transparent pixels with some specific color. If we don't choose any specific color then MATLAB gives it black color
  1 Commento
Tejas Waje
Tejas Waje il 10 Gen 2017
If I have a background image and I need to use a foreground image with some part transparent , what should I do?

Accedi per commentare.

Più risposte (1)

barbara anderson
barbara anderson il 15 Apr 2020
Convert it into greyscale image and plot it.


Scopri di più su Lighting, Transparency, and Shading in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by