LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-06-2005, 09:32 PM   #1
datatab1
LQ Newbie
 
Registered: Sep 2005
Location: USA western
Distribution: fedora core 4
Posts: 10

Rep: Reputation: 0
finding information on image properties


is anyone farmiliar with bitmaps? or images in general, i need to find the width and height of an image because it is not avalible in the library i am using.

or does anyone know where to find this out?
 
Old 10-06-2005, 11:06 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
It depends entirely on the specific format.

Most graphics formats include h/w in the header ... but not all ... and it's almost always in a different representation, and at a different offset, in the file.

You need to know what kind of format you're dealing with!

Here's a great resource that might help:

http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html
<= This is just one of many similar pages you can find from "google"

I'd also consider downloading and studying the source code for either of these legendary programs:

XV:
http://www.trilon.com/xv/downloads.html

The Gimp:
http://www.gimp.org/

'Hope that helps .. PSM
 
Old 10-07-2005, 12:20 AM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,088

Rep: Reputation: 299Reputation: 299Reputation: 299
In addition, www.wotsit.org is a good resource for finding details about various file formats (not just graphics).
 
Old 10-07-2005, 12:37 AM   #4
datatab1
LQ Newbie
 
Registered: Sep 2005
Location: USA western
Distribution: fedora core 4
Posts: 10

Original Poster
Rep: Reputation: 0
hmmm, they're ok,
i just have no idea what to google for, tried some things with bitmap and format or standard, didn't work.

what should i google for? header or something?

i'll take a closer look at those resources too.
 
Old 10-07-2005, 01:16 AM   #5
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
OK, let's break it down:

1. Let's assume you want to know the height and width of a file

2. You clearly need to know what the file type is before you can determine the
height and width (or, for that matter, anything ELSE about the file). Right?

3. OK: maybe you already know the file type.
Great.

Look up the file format in one of the links above (or a link you've google'd for) and find where
the height and width is stored in the file header.

4. Maybe you can find a file parser to do this (there are plenty of them out there: including
in "xv" and "The Gimp". Or, for that matter, use "Windows, <Right-click>, Properties").

5. Otherwise, you can use a hex editor and look at the bytes.

The Linux command "od -cx FILENAME | less" is a common way to do this.

The goal, of course, is to match the bytes in the file spec (from the web link) to the corresponding
bytes in the file (which you're examining with "od -cx FILENAME | less").

6. Now let's assume you DON'T know the file type.
That's OK, too.

Many files can be identified by suffix (that's how Windows Explorer works).

Most graphics files have a "magic number" in the first bytes of their header
to identify the file type. The file format links above will give you a clue about
these "magic numbers".

And, if you're on Linux, you can use the "file FILENAME" command. Which is intelligent about
a lot of different file suffixes (like Windows) and about a lot of "magic numbers" (very UNLIKE
Windows).

'Hope that helps .. PSM
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking to extract image properties in C++ plisken Programming 1 11-24-2005 08:22 AM
Finding Image Magick Binary Cyric Slackware 1 10-17-2004 09:28 PM
Finding information about the current shell atirya_yodha Linux - Newbie 3 03-18-2004 01:30 PM
Need help finding information for Mandrake. CyberLord_7 Mandriva 3 10-15-2003 03:30 PM
perl script to insert image information rhuser Programming 1 03-12-2003 05:23 AM


All times are GMT -5. The time now is 04:00 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration