473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

access tga image size

hi all

Is it possible to access the size (with and height) of a .tga image in
python? From the documentation I would say no, but I'm pretty new to
python...

if the answer really is no, has someone a suggestion how else I could
write a little script that computes the total area of a large nuber of
image files in a folder? I should check texturespace for 3D Models,
and would like to avoid copy pasting them all into Photoshop...

thanks for your trouble

haddock
Jul 18 '05 #1
2 2593
You will need to get and install a copy of
PIL (Python Imaging Library) available at:

http://www.pythonware.com/products/pil/index.htm

then in Python:

import Image

filepath='<insert filename path here>'
im=Image.open(filepath)
height, width=im.size
print "%s-height=%i, width=%i" % (filepath, height,
width)

or for all files in a directory

import glob
import Image

filepathlist=glob.glob(r"c:\images\*.tga")
for filepath in filepathlist:
im=Image.open(filepath)
height, width=im.size
print "%s-height=%i, width=%i" % (filepath, height,
width)
Larry Bates
Syscon, Inc.
"haddock" <sa************@gmx.ch> wrote in message
news:8c*************************@posting.google.co m...
hi all

Is it possible to access the size (with and height) of a .tga image in
python? From the documentation I would say no, but I'm pretty new to
python...

if the answer really is no, has someone a suggestion how else I could
write a little script that computes the total area of a large nuber of
image files in a folder? I should check texturespace for 3D Models,
and would like to avoid copy pasting them all into Photoshop...

thanks for your trouble

haddock

Jul 18 '05 #2
thank you very much, that was most helpful.
Jul 18 '05 #3

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

Similar topics

4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
6
by: Larry R Harrison Jr | last post by:
I have Access XP, and the following code which is supposed to assign a JPEG to an image control: Me.Image9.Picture = "F:\Pictures\CP775_SonyDSCP50\FingerRockNight_Resize.jpg" I get this error...
0
by: TheCoder | last post by:
I am making a D-base with web conectivity for my class project. I have everything working but the subit button sends the data to the correct fields but afterwards it wants to reproduce new blank...
7
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
1
by: PALLAVI SHARMA | last post by:
Sir, i have configure the ms access file on webserver. MS. Access file is showing in .../db/mohan.mdb on web server. could you tell me what path should in write in my language to update the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.