Code covered by the BSD License  

Highlights from
Plot to Bitmap

5.0 | 2 ratings Rate this file 14 Downloads (last 30 days) File Size: 13.5 KB File ID: #23468 Version: 1.3
image thumbnail

Plot to Bitmap


Dirk-Jan Kroon (view profile)


29 Mar 2009 (Updated )

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

| Watch this File

File Information

"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.


This file inspired Contest Clock.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
11 Jun 2015 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,

17 Mar 2010 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.

31 Mar 2009 1.1

Add Font sizes, and fixed missing capital "Y"

03 Apr 2009 1.2

Fixed small gap bug, by rounding values of input coordinates

24 Jan 2011 1.3

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

Contact us