Click here to Skip to main content
Click here to Skip to main content
Go to top

Send Picture Message from PC to Mobile

, 4 Jul 2007
Rate this:
Please Sign up or sign in to vote.
This article will help you to send a picture + text as SMS from PC to mobile.........using C#

Introduction

Some days ago, I was wondering whether I could send a picture from my PC to mobile? After a lot of thinking, I came to know that I could do so. This article is a sample example for you in order to send a picture to your mobile. Text and picture messages have the same method for sending, but the only difference is the length of the message. You can fit your text into one message like if you just send "hello", but it's difficult to fit a picture in one message because you have a complete format for the picture. I am using OTA format for sending pictures to my mobile phone Sony Ericsson k500i.

Background

To understand this article, you must have knowledge of how to send text SMS.

OTA

Over the Air (OTA) is an image format for mobile phones which has standard size of 72x28, etc. It has only two colors, black and white. Read this article for how to convert an image into OTA format.

Details

First of all, convert your image into OTA format and copy all its data in any file like *.txt, *.doc, etc. Here is an example for the OTA data of image.

66 66 66 66 66 66 66 66 66 99 99 99 99 99 99 99 99 99 80 00 00 00 00 00 00 00 01
40 00 00 00 60 00 E0 00 02 40 00 00 0E 90 03 10 00 02 80 00 00 31 08 0C F3 B8 01
80 00 00 40 04 11 04 44 01 40 00 00 FF FE 2F 8B 12 02 40 00 00 00 00 53 8C AA 02
80 00 00 00 00 62 89 C4 01 80 00 00 00 00 41 41 40 01 40 00 00 00 00 01 42 80 02
40 00 20 00 00 01 42 80 02 80 01 F0 00 00 00 A2 80 01 80 0F FE 00 00 00 A5 00 01
5F FF FF FF FF FE A5 7F FA 40 0A AA 00 00 00 55 00 02 82 01 50 04 40 01 5D 08 A1
88 10 24 80 00 40 FF 02 01 40 41 00 01 00 03 AB E0 02 44 00 00 08 20 0D 55 58 82
80 10 14 40 00 1A AA AC 01 80 00 00 00 00 35 55 56 01 40 01 00 00 80 6A AA AB 02
40 00 00 00 00 55 55 55 02 80 00 00 00 00 00 00 00 01 99 99 99 99 99 99 99 99 99
66 66 66 66 66 66 66 66 66 

As we know, when we send text SMS, we encode our text into PDU. So the same method will be used for the picture SMS.

PDU for Picture SMS (Encoding Picture)

The following example shows how to encode a picture SMS. The example includes a picture and a text "Test". The length of the Picture message is so long that the message must be sent as a concatenated message (in three SMS). Here is the encoded data:

First part: (length =140)

8C0B0504158A00000003010301300000045465737402010000481C0166666666
6666666666999999999999999999800000000000000001400000006000E00002
400000E900310000280000031080CF3B801800000400411044401400000FFFE2
F8B12024000000000538CAA0280000000006289C401800000000041414001400
00000001428002400020000 

Second part: (length =140)

8C0B0504158A00000003010302014280028001F0000000A28001800FFE000000
A500015FFFFFFFFFFEA57FFA400AAA0000005500028201500440015D08A18810
2800040FF0201404100010003ABE00244000008200D55588280101440001AAAA
C0180000000003555560140010000806AAAAB024000000000555555028000000
000000000199999999999999 

Third part: (length =23)

170B0504158A000000030103039999666666666666666666 

Explanation for the First Part

  • 8C length of part 1 (280/2=140(dec) and 8C(hex) because our data is in hex)
  • 0B length of user data header
  • 05 Identifier (IEI; application port addressing scheme, 16-bit port address)
  • 04 Information Element Data Length (IEDL)
  • 158A Information Element Data (destination port)
  • 0000 Information Element Data (originator port)
  • 00 Information Element Identifier (IEI; concatenated short message, 8-bit reference number)
  • 03 Information Element Data Length (IEDL)
  • 01 Information Element Data (concatenated short message reference number)
  • 03 Information Element Data (total number of concatenated messages (0-255))
  • 01 Information Element Data (sequence number of current short message)
  • 30 Identifier for version, current version is (ASCII) zero "0". If it is not "0", stop processing of the message.
  • 00 "00" <Item-length>
  • 00 Text length
  • 04 Text length
  • 54657374 "Test"
  • 02 "02" = <Item length><OTA bitmap>
  • 0100 <Item-length> value 0100(hex) = 256(dec) = 4 octets for header and the rest for OTA bitmap data
  • 00 The first byte of the bitmap must be 00 (hex); i.e., OTA bitmap header field 'number of animated icons' must hold 0, indicating that there is no animation, just a single static image.
  • 48 Width = 48(hex) = 72(dec)
  • 1C Height = 1C(hex) = 28(dec)
  • 01 The depth of the bitmap (number of grey scales)

All the rest is the image data.

Explanation for the Second Part

  • 8C length of part 2 (280/2=140(dec) and 8C(hex) because our data is in hex)
  • 0B length of user data header
  • 05 Identifier (IEI; application port addressing scheme, 16-bit port address)
  • 04 Information Element Data Length (IEDL)
  • 158A Information Element Data (destination port)
  • 0000 Information Element Data (originator port)
  • 00 Information Element Identifier (IEI; concatenated short message, 8-bit reference number)
  • 03 Information Element Data Length (IEDL)
  • 01 Information Element Data (concatenated short message reference number)
  • 03 Information Element Data (total number of concatenated messages (0-255))
  • 02 Information Element Data (sequence number of current short message)

All the rest is the image data.

Explanation for the Third Part

  • 17 length of part 3 ((48-2)/2=23(dec) and 17(hex) because our data is in hex)
  • 0B length of user data header
  • 05 Identifier (IEI; application port addressing scheme, 16-bit port address)
  • 04 Information Element Data Length (IEDL)
  • 158A Information Element Data (destination port).
  • 0000 Information Element Data (originator port)
  • 00 Information Element Identifier (IEI; concatenated short message, 8-bit reference number)
  • 03 Information Element Data Length (IEDL)
  • 01 Information Element Data (concatenated short message reference number)
  • 03 Information Element Data (total number of concatenated messages (0-255))
  • 03 Information Element Data (sequence number of current short message)

All the rest is the image data.

Now we have divided our image into a number of parts. So add the following data in the front of each part.

0051000C91xxxxxxxxxxxx00F5A7 

Explanation

  • 00 always added
  • 5100 not going to explain here
  • 0C length of phone number
  • 91 phone number format (91=international and 81=national)
  • xxxxxxxxxxxx 12 digit phone number (for example my phone number is 23216427434. write it as 292361244743)
  • 00F5 not going to explain here
  • A7 time limit (24 hours in this case)

Complete Example

SMS # 1:
0051000C913012467234F400F5A78C0B0504158A000000030103013000000
45465737402010000481C0166666666666666666699999999999999999980
0000000000000001400000006000E00002400000E90031000028000003108
0CF3B801800000400411044401400000FFFE2F8B12024000000000538CAA0
280000000006289C401800000000041414001400000000014280024000200000

SMS # 2:

0051000C913012467234F400F5A78C0B0504158A000000030103020142800
28001F0000000A28001800FFE000000A500015FFFFFFFFFFEA57FFA400AAA
0000005500028201500440015D08A188102800040FF0201404100010003AB
E00244000008200D55588280101440001AAAAC01800000000035555601400
10000806AAAAB024000000000555555028000000000000000199999999999999

SMS # 3:
0051000C913012467234F400F5A7170B0504158A0000000301030399996666
66666666666666

Send Picture SMS

The code for how to send a simple text SMS is attached with this article. Just paste your SMS PDU and send your cute picture massage. Remember that I am using a serial port for the communication.

Or

You can use Windows hyper terminal for sending your message.

Start->Programs->Accessories->Communications->HyperTerminal

  • And then use the following commands for sending SMS:
  • AT+CMGF=0 (pdu mode, use the command only first time if you have multiple SMS like in our case, three SMS.)
  • AT+CMGW=(length of pdu, for example 153 in SMS # 1)
    > write your pdu, in the end press ctrl+z and then press Enter. If it will display Ok, then succeeded. It will also display the message number.
  • AT+CMSS=(message number)

And now your message has been sent.

Future Work

I am trying to send MMS as well, using C#.

References

  • Nokia Smart_Messaging_FAQ_v2_0

History

  • 5th July, 2007: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shakeel Mumtaz
Web Developer
Pakistan Pakistan
I did BS in Computer Science from Punjab University,Pakistan.
 
I have developed lot of Softwares and mostly interested in mathematics,image processing,AI,signal processing,mobile technology,database etc.
 
Currently working at Confiz Solutions as Sr.Software Engineer.

Comments and Discussions

 
Questioncannot send image to mobile via pc Pinmemberpavan.srs428-Jan-13 1:17 
hey i cannot send image from pc to mobile yar.i ran ur code but its giving me error.please help me out na
Questionhwo to to send MMS as well, using C#. PinmemberMember 96489792-Dec-12 1:34 
Generalnathing PinmemberAnuj jangra4-Mar-12 23:05 
Questionnathing PinmemberAnuj jangra4-Mar-12 23:02 
Generalhai Pinmemberachi 1232-Feb-12 5:12 
GeneralHi PinmemberAmsharam19-Jan-12 1:11 
Questionhappy christmas Pinmembermuniyamma m23-Dec-11 18:15 
Questionbbbb Pinmemberakankhya21-Dec-11 5:14 
Generalhi Pinmembervadecha bharat14-Dec-11 3:16 
Generalphoto Pinmemberdimpuvara1-Dec-11 22:56 
GeneralRe: photo PinmemberMember 849120715-Dec-11 1:27 
GeneralRe: photo PinmemberSAMIR PATRA5-Apr-12 5:33 
GeneralRe: photo PinmemberSAMIR PATRA5-Apr-12 5:35 
GeneralRe: photo Pinmemberpratik gondole25-Jan-13 1:59 
GeneralRe: photo Pinmemberwaseem akram11-Jun-12 0:00 
General9848722979 Pinmembershiva kumar mekala14-Oct-11 8:06 
Questionpakistan Pinmembermanojaan29-Sep-11 22:23 
Questionbj Pinmemberabhi kus28-Aug-11 19:56 
Generaldalpat Pinmembervadu dalpat1-Aug-11 0:55 
GeneralHai ra PinmemberSuresh.avk.naidu15-Jul-11 18:00 
Questiongjhgfjhgjkfj Pinmembertufan sadhukhan24-Jun-11 21:30 
Generalcxccxcx Pinmemberabrarpc415-Mar-11 21:31 
General8270394443 Pinmemberrupesht714-Mar-11 6:51 
Generalrequest Pinmemberm shuja6-Mar-11 5:33 
GeneralRe: request PinmemberMoeed Khan13-Apr-11 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 5 Jul 2007
Article Copyright 2007 by Shakeel Mumtaz
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid