473,605 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.png to hexadecimal


I have not had any luck with this on other groups so I am posting it here.
I created a .rtf file using MS Word that included text and graphics(.png
file) . I then viewed this file with notepad. Using VB2005 I created a
string variable that could recreate the file with values input be the user.
I can get the text with formating to work perfectly, but I have not had any
luck with the graphics. As best I can tell the graphic is saved as a
hexadecimal number. I want to build this number in code using VB, so that I
can include it in the string variable that creates the .rtf file. The below
code starts out looking like the same number produced by MS Word but soon
strays. I hope that this makes enough sense for someone to be able to help
me. I think that if I can produce some code that will give the string
representation of the hexadecimal values of a picture I will be on the
correct path.

Public Sub subReadPicture( )

Dim strPic As String
Dim intLength As Int32
Dim strHex As String
Dim builder As New System.Text.Str ingBuilder(Stri ng.Empty)

intLength = (UBound(My.Comp uter.FileSystem .ReadAllBytes(s trAppPath &
"Graphics\Drago n.png")))

Dim byt(intLength) As Byte

byt = My.Computer.Fil eSystem.ReadAll Bytes(strAppPat h &
"Graphics\Drago n.png")

For x As Integer = 0 To intLength

strHex = Hex(byt(x))
builder.Append( strHex)

Next

strPic = builder.ToStrin g

End Sub

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.c om<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Aug 2 '05 #1
0 1835

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2689
by: James DeClerk | last post by:
Hi everyone. I'm new to C++ and I've got a seemingly tough problem to tackle. I have a union. This union needs to be converted into hexadecimal format. The hexadecimal number is then inserted into a Binary (255) column in a SQL Server DB. The program will be complied on the unix platform using gcc. union account
10
22705
by: pavithra.eswaran | last post by:
Hi, I would like to convert a single precision hexadecimal number to floating point. The following program seems to work fine.. But I do not want to use scanf. I already have a 32 bit hexadecimal number and would like to convert it into float. Can anyone tell me how to do it? int main() { float theFloat;
5
7898
by: Damon | last post by:
I'm getting '', hexadecimal value 0x02, is an invalid character when I'm deseralizing XML from a 3rd party XML gateway. How do I get rid of these hexadecimal values before I deserialize? Cheers Damon
1
2870
by: Fernando Barsoba | last post by:
Hi all, First of all, I'd like to thank you "Skarmander" and "Flash Gordon" for the help they provided me: Skarmander's algorithm and Flash's modifications helped me a lot. Here's the problem I had and the question which I still have regarding that problem: I tried to send a hex string to a function that performed message
15
35476
by: jaks.maths | last post by:
How to convert negative integer to hexadecimal or octal number? Ex: -568 What is the equivalent hexadecimal and octal number??
8
18643
by: Vijay | last post by:
Hi , I am doing a small project in c. I have a Hexadecimal file and want to convert into ascii value. (i.e., Hexadecimal to Ascii conversion from a file). Could anyone help me? Thanks in adv.
7
19208
by: elliotng.ee | last post by:
I have a text file that contains a header 32-bit binary. For example, the text file could be: %%This is the input text %%test.txt Date: Tue Dec 26 14:03:35 2006 00000000000000001111111111111111 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111110000000000000000
5
11647
by: Just D | last post by:
All, Any valuable idea about subj: "The '%' character, hexadecimal value 0x25" ? I tried to google, but nothing interesting was found. Is it IIS settings problem, user side problem or whatever? We receive it regularly and I guess the problem is not in our source codes. Please help! Just D.
6
14421
by: Andrea | last post by:
Hi, suppose that I have a string that is an hexadecimal number, in order to print this string I have to do: void print_hex(unsigned char *bs, unsigned int n){ int i; for (i=0;i<n;i++){ printf("%02x",bs); } }
6
16896
by: sweeet_addiction16 | last post by:
hello Im writin a code in c... can sum1 pls help me out in writing a c code to convert decimalnumber to hexadecimal number.The hexadecimal number generated has to be an unsigned long.
0
8004
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8425
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1541
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1271
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.