kudos 127
Recognized Expert New Member
Do you remeber the OTA format? The simple graphic format that you could send as a SMS message? Anyway, I found a cool OTA image on my cellphone, and wanted to extract it to a "normal" graphics format, and add it to a t-shirt (it also writes the image out to stdout as a number of '#'s) -
#ota2tga
-
-
def writetga(width,height,data,filename):
-
f = open(filename,"wb")
-
file = ""
-
file+="%c%c%c" % (0,0,2)
-
file+="%c%c%c%c%c" % (0,0,0,0,0)
-
file+="%c%c%c%c" % (0,0,0,0)
-
file+="%c%c" % ((width & 0x00ff)%0xff,(width & 0xff00)%0xff)
-
file+="%c%c" % ((height & 0x00ff)%0xff,(height & 0xff00)%0xff)
-
file+="%c%c" % (0x18,0x0)
-
for i in range(height):
-
for j in range(width):
-
file+="%c%c%c" % (data[j+(height-1-i)*(width-1)][0],data[j+(height-1-i)*(width-1)][1],data[j+(height-1-i)*(width-1)][2])
-
f.write(file)
-
f.close()
-
-
# add the name of your .ota file here.
-
f = open("Grafikkmelding.ota","rb")
-
info = ord(f.read(1))
-
width = ord(f.read(1))
-
height = ord(f.read(1))
-
color = ord(f.read(1))
-
-
pixmap = [[255,255,255]]*(72*28)
-
print width
-
print height
-
x = 0
-
y = 0
-
l = ""
-
for i in range(height):
-
for j in range(width / 8):
-
v = ord(f.read(1))
-
for k in range(8):
-
if( ((v >> 7-k) & 0x01) == 0):
-
l+=" "
-
pixmap[x+y*width] = [255,255,255]
-
else:
-
l+="#"
-
pixmap[x+y*width] = [0,0,0]
-
x+=1
-
if(x > width):
-
x=0
-
y+=1
-
l+="\n"
-
f.close()
-
print l
-
writetga(width,height,pixmap,"output.tga")
-
-kudos
0 3300 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Marco |
last post by:
Hi,
I am searching for a tool that extract information from a HTLM page
and format it in xml format
For instance for this page:
http://money.guardian.co.uk/pensions/story/0,6453,993138,00.html
get an xml file
with a <title> with the title of the article
|
by: cstudent79 |
last post by:
Hello folks,how do u do ?
I want to develop an application that can extract text from a
powerpoint presentation.But i am in dark about the powerpoint file
format.I would be obliged if somebody can help me with the file
format.
Thank u.
|
by: bsimaie |
last post by:
Hello group
Since I want to modify a large program written in C(40K line) for the
academic purposes and the program compose of several modules, it is
necessary to have software structure in order to modify the
program.Unfortunately the program has no documentation regarding
software structure except comments inside code.
Anybody knows what is the best tool for extracting structure of the
large programs such as one I indicated above.?...
|
by: _BNC |
last post by:
I've been looking for a couple weeks for a regex expression that will
extract text from html in a form that will look like IE screen output.
I'm sure one of you guys hid it somewhere as a joke, but it's not funny
any more. Give it up, OK?
Seriously, I've checked regexlib.com and regular-expressions.info and lots
of google searches. I find tag extractors and other related stuff but
haven't come up with the 'visible text' extractor.
...
|
by: Vijay |
last post by:
h
any know how the website extractor tool works
thanks & regard
Vijay
| |
by: isbat1 |
last post by:
I need to extract some embedded resources back to disk from a .net
assembly.
What tool do I need, and where do I get it?
|
by: Randy |
last post by:
Since these operators can't be member functions, and since
friend functions can't be declared virtual, how do I make my
inserters and extractors polymorphic?
--Randy Yates
|
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...
|
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |