<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to scale a bitmap drawn with M5.Display.drawBitmap() on M5Stack?]]></title><description><![CDATA[<p dir="auto">I am working with an M5Stack Core S3 using the <code>&lt;M5Unified.h&gt;</code> library. I successfully display a 32×32 bitmap stored as a <code>uint16_t</code> array (RGB565 format) using <code>M5.Display.drawBitmap()</code> (see my code below). The bitmap represents a small animal, but at its native resolution it appears too small on the display (see the result below). At the moment, <code>M5.Display.drawBitmap()</code> draws the image at a 1:1 pixel ratio, and I don’t see an obvious way to apply scaling. <strong>How to scale the image by an integer factor (for example, 2 or 3) so that it appears larger on the display?</strong></p>
<p dir="auto"><strong>My result:</strong><br />
<img src="/assets/uploads/files/1766316514821-20251221_122614-resized.jpg" alt="20251221_122614.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>My <code>main.cpp</code> code:</strong></p>
<pre><code>#include &lt;M5Unified.h&gt;

constexpr int IMG_W = 32;
constexpr int IMG_H = 32;

const uint16_t myBitmap[IMG_W * IMG_H] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xffff, 0x0823, 0x0000, 0x0000, 0x0000, 0x0823, 0xffff, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xffff, 0xffff, 0x0823, 0x0823, 0x0823, 0xffff, 0xffff, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xff39, 0x0823, 0x0823, 0xff39, 0xff39, 0xff39, 0x0823, 0x0823, 0xff39, 0xff39, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xff39, 0xf653, 0x0823, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0x0823, 0xff39, 0xf653, 0xff39, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xff39, 0x0823, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0x0823, 0xff39, 0xff39, 0xf653, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xff39, 0x0823, 0xff39, 0x0823, 0xff39, 0xff39, 0x0823, 0xff39, 0xff39, 0x0823, 0xff39, 0xf653, 0x0823, 0x0823, 0x0823, 0x0823, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0x0823, 0xff39, 0x0823, 0xff39, 0xff39, 0x0823, 0xff39, 0xff39, 0xf653, 0x0823, 0x0823, 0x0823, 0xf653, 0xff39, 0xff39, 0xff39, 0xff39, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0xf653, 0xf653, 0xf653, 0xf653, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xfd35, 0xfd35, 0xfd35, 0xfd35, 0xff39, 0xff39, 0xff39, 0xf653, 0xf653, 0xf653, 0xf653, 0xf653, 0xf653, 0xff39, 0xff39, 0xff39, 0xff39, 0xff39, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xf410, 0xfd35, 0xf410, 0xfd35, 0xfd35, 0xf653, 0xf653, 0xf653, 0x0823, 0xf653, 0xf653, 0xf653, 0xf653, 0xf653, 0xf653, 0xff39, 0xff39, 0xf653, 0x0823, 0xf653, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xfd35, 0xfd35, 0xfd35, 0xfd35, 0xfd35, 0xf653, 0x0823, 0x0823, 0xe4ed, 0xf653, 0xf653, 0xff39, 0xff39, 0xf653, 0xf653, 0xf653, 0xf653, 0xf653, 0x0823, 0xe4ed, 0xf653, 0x0823, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0x0823, 0x0823, 0x0823, 0x0823, 0x0823, 0xe4ed, 0xe4ed, 0xf653, 0xf653, 0xff39, 0xff39, 0xff39, 0xff39, 0xf653, 0xf653, 0xf653, 0xe4ed, 0x0823, 0x0823, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xf653, 0xf653, 0xf653, 0xf653, 0xff39, 0xff39, 0xff39, 0xe4ed, 0xf653, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xf653, 0xe4ed, 0x0823, 0x0823, 0x0823, 0xe4ed, 0xe4ed, 0xe4ed, 0x0823, 0x0823, 0x0823, 0x0823, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xf653, 0xe4ed, 0x0823, 0x0000, 0x0823, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 0x0823, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0xf653, 0xe4ed, 0x0823, 0x0000, 0x0823, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 0x0823, 0xe4ed, 0xe4ed, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0823, 0x0823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 
};

void setup() {

  auto cfg = M5.config();

  M5.begin(cfg);

  M5.Display.clear(TFT_BLACK);

  M5.Display.drawBitmap(50,50,IMG_W,IMG_H,myBitmap);
 
}

void loop() {

}
</code></pre>
<p dir="auto"><strong>My development enviroment:</strong></p>
<ul>
<li>Windows 10 Pro 22H2</li>
<li>Visual Studio Code  1.99.1 with PlatformIO 3.3.4</li>
<li>M5Stack Core S3</li>
</ul>
]]></description><link>https://community.m5stack.com/topic/7958/how-to-scale-a-bitmap-drawn-with-m5-display-drawbitmap-on-m5stack</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 14:12:44 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7958.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 21 Dec 2025 11:29:39 GMT</pubDate><ttl>60</ttl></channel></rss>