Embed image in a DataSection [SOLVED]

Just starting out? Need help? Post your questions and find answers here.
daveb
User
User
Posts: 30
Joined: Tue Jun 07, 2022 6:12 pm

Embed image in a DataSection [SOLVED]

Post by daveb »

I have been struggling to find a way to encode an image to embed it in a DataSection like this:

Code: Select all

DataSection
  Image_start:
    Data.q $0A1A0A0D474E5089,$524448490D000000,$2400000024000000,$9800E10000000608,$4752730100000098
    Data.q $0000E91CCEAE0042,$0000414D41670400,$00000561FC0B8FB1,$0000735948700900,$C701C30E0000C30E
    Data.q $494307000064A86F,$6D96ED4758544144,$DCF3CFC71567548C,$3BB6F3B9DEE77BF7,$D0897128A5D0EFB0
    Data.q $5356D0D0AC1696B2,$312F8D687E8C496D,$A4D536B49B56C486,$BF135A86B131B589,$2D2D144D6B46C1F8
    Data.q $80974B29A143428A,$B17616AE94AE9BAC,$E67733B0ECECCEFB,$71B201D8678F3FBE,$9326FEE0FC1FA8A1
    ........
  Image_end:
EndDataSection
I found a forum post dating back to August 2008 asking the same question: http://forums.purebasic.com/english/vie ... 47#p257175
Unfortunately, I cannot get any of the proposed solutions to work for me.
Any pointers or recommendations of other mechanisms or software to produce this encoded data would be much appreciated

TIA
Dave
Last edited by daveb on Fri Sep 30, 2022 4:49 pm, edited 1 time in total.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Embed image in a DataSection

Post by Little John »

I would do it lke this:

Code: Select all

DataSection
   ImageStart:
   IncludeBinary "MyImage.png"
   ImageEnd:
EndDataSection 
daveb
User
User
Posts: 30
Joined: Tue Jun 07, 2022 6:12 pm

Re: Embed image in a DataSection [Solved]

Post by daveb »

Thanks Little John,
Nice clean simple solution.
Regards Dave
Post Reply