Storing images as byte arrays in a seperate file within a sketch folder

Iv been using an LCD screen on my Arduino Mega and have recently found out about storing images as Byte Arrays using a small windows based tool to convert an image.

I then copy/paste this byte array (quite alot of charters) at the top of the arduino sketch and can reference and use the byte array/image on my LCD screen which is great!

The problem is this makes the sketch VERY long when having multiple images....

How do I go about storing this byte arrays (images) in a separate file such as a .c or .h file within my sketch folder which I can then still access to within my sketch for use on the LCD screen?

A quick step by step guide would be great because im 100% this is possible to do.

Thanks!

#include is your friend. Create a new file called "image_a.h", paste the text in from your first image. Create a second file called "image_b.h" and paste the text from the second image.

Then at the top of your sketch, you do this:

#include "image_a.h"
#include "image_b.h"

The compiler will insert your files at that point.

Am I able to have ALL of the byte arrays in a .h file or do I actually need all 10 of them in individual .h files??

Horendus:
Am I able to have ALL of the byte arrays in a .h file or do I actually need all 10 of them in individual .h files??

This is one of those cases (and there are many) where you would find out much quicker just by trying it out rather than by asking a question here.

You can put them all in one file.

...R