File Exchange

image thumbnail

Plot to Bitmap

version 1.3 (13.5 KB) by

Plot lines (and text) directly into a bitmap, including filled polygons.



View License

"Plot to Bitmap" allows the user to directly plot lines, text and filled polygons into an image, thus without taking a screen-shot (getframe).

This function is also useful if you want to convert a few coordinates describing a region contour into a bitmap of the region.

Comments and Ratings (2)

Xiaoyu Wu

Hi Dirk,

Thank you very much for this code. Can you please modify the code so that when you plot on grey scale bmp file, the lines you plot can have RGB colors (e.g. red, green, blue) ? Currently all the plots on the bmp files only display in grey color.

Very Best,

Peter Bone

Peter Bone (view profile)

Very good. This made it possible for me to create synthetic images to test an image processing algorithm.
Doesn't fill polygons right to the edge of the image. X and Y seem to be flipped in the bitmapplot function.



Replace for-loop by arrayfun. Allow multiple marker-colors.


Fixed small gap bug, by rounding values of input coordinates


Add Font sizes, and fixed missing capital "Y"

MATLAB Release
MATLAB 7.7 (R2008b)

Inspired: contest clock

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today