Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Convert PNG or BMP logo image to C array Arduino

imranahmed

Advanced Member level 3
Joined
Dec 4, 2011
Messages
768
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
Karachi,Pakistan
Activity points
6,134
Please let me know how to convert PNG or BMP logo image to C array. I have thermal printer QR-701, TTL, 9600baud, Page Width 58mm.
I want to print logo and I am using Arduino Mega2560.
Logo is attached and please let me know how to set image size according to my thermal printer.
 

Attachments

  • BSL.png
    BSL.png
    8.7 KB · Views: 4

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,443
Helped
4,299
Reputation
8,603
Reaction score
4,260
Trophy points
1,393
Activity points
128,956
Hi,

Baud rate and paper width means nothing.
Pixel count in X and Y is what matters.
Read the printer datasheet.

Klaus
 

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,247
Helped
377
Reputation
754
Reaction score
375
Trophy points
83
Activity points
13,504
Have you tried Google? My search came up with quite a few options, both on-line tools and source code.
Susan
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,443
Helped
4,299
Reputation
8,603
Reaction score
4,260
Trophy points
1,393
Activity points
128,956
Hi,

Any picture data can be put into a array of bytes.

Often those printer manufacturers provide a (online) tool.
Do a search on their internet site.

Then it depends on the expected data format. Usually an uncompressed black/white bitmap is simple to transform to the printer bitmap.

Klaus
 

imranahmed

Advanced Member level 3
Joined
Dec 4, 2011
Messages
768
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
Karachi,Pakistan
Activity points
6,134
Have you tried Google? My search came up with quite a few options, both on-line tools and source code.
Susan
Yes I tried google. Only few options are available but it is working I tried it on my printer.
--- Updated ---

Hi,

Any picture data can be put into a array of bytes.

Often those printer manufacturers provide a (online) tool.
Do a search on their internet site.

Then it depends on the expected data format. Usually an uncompressed black/white bitmap is simple to transform to the printer bitmap.

Klaus
Ok.
 

student_078

Newbie level 5
Joined
Mar 17, 2021
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
Arduino is not power enough to decode PNG images, as the decoding algorithm in line reconstruction can easily cause overflow in the RAM.
You can search for bmp file format, it's not compressed so you read raw binary files after 54 bytes of header.
 

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,247
Helped
377
Reputation
754
Reaction score
375
Trophy points
83
Activity points
13,504
I'm not sure that the OP was suggesting USING an Arduino to do the conversion. I take it that they want the result of the conversion to be used by the Arduino to send to the printer.
Susan
 

student_078

Newbie level 5
Joined
Mar 17, 2021
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
I'm not sure that the OP was suggesting USING an Arduino to do the conversion. I take it that they want the result of the conversion to be used by the Arduino to send to the printer.
Susan
In that scenario windows Paint can convert PNG into bmp files. Reading bmp into array in C is easy task.
 

Liksy

Newbie
Joined
Apr 7, 2021
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
LA
Activity points
19
Any graphics editor convert PNG to BMP files. And as written above "Reading bmp into array in C is easy task."
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top