Determining image information from the command line on OS X using file
For a file that is an image, you can determine the type of image from
a shell prompt, e.g., from a Terminal window, on an OS X system using
the file command:
$ file menu_button
menu_button: PNG image data, 18 x 18, 8-bit/color RGB, non-interlaced
For PNG images, the command will also reveal the size of the image, e.g., for
the example above the image is 18 pixels wide by 18 pixels high. The first
number is the width and the second number is the height, though in this case
the height equals the width.
The command can be useful if a file has a missing extension or if you need
to verify that the file extension matches the actual image type.
The command determines the type of image stored in a file from a
stored near the beginning of the file. For PNG images, the
PNG file header, which is the first 8 bytes
of the file, will contain ASCII
89 P N G cr nl sub nl. CR
represents a carriage return (octal 15, decimal 13, hexadecimal 0D) and NL
represents a newline, aka line feed, character (decimal 10, octal
12, hexadecimal 0A). ASCII SUB is octal 032, decimal 26 and hexadecimal
1A. The first character before "PNG" is octal 211, which is decimal 137 and
You can see the characters at the beginning of the file using the
od utility, which is a filter which displays the specified files,
or standard input if no files are specified, in a specified format. Supported
formats include octal, decimal, hexadecimal, or
ASCII. E.g, to display the
first 8 bytes of a file in ASCII format, you can use the
to display the data in ASCII format and the
-N option to display
only the first 8 bytes.
$ od -a -N 8 menu_button
0000000 89 P N G cr nl sub nl
89 is the hexadecimal number for the first byte; that
is 137 in decimal and 211 in octal. The first 8 bytes in octal
format are shown below:
$ od -b -N 8 menu_button
0000000 211 120 116 107 015 012 032 012
hexdump command with the
-C ("C" stands
for "canonical") option can be used to display both hexadecimal and
ASCII output at the same time.
$ hexdump -C -n 8 menu_button
00000000 89 50 4e 47 0d 0a 1a 0a |.PNG....|
For GIF files,
file displays the size of the image with the first number, 165 in
the example below, being the width and the second number, 57, being
$ file home.gif
home.gif: GIF image data, version 89a, 165 x 57
File can determine that a file is a GIF file because for a GIF file the
first 6 characters of the file will be ASCII
$ od -a -N 6 home.gif
0000000 G I F 8 9 a
You can display both the hexadecimal and ASCII characters with the
hexdump command using the
$ hexdump -C -n 6 home.gif
00000000 47 49 46 38 39 61 |GIF89a|
For JPG files,
the file command won't display the image dimensions, but will display
any comments stored within the image.
$ file A12.jpg
A12.jpg: JPEG image data, JFIF standard 1.01, comment: "Processed By eBay with ImageMag"
The first two bytes of a JPG file are hexadecimal FF D8 and the last
two bytes in the file are hexadecimal FF D9
$ hexdump -n 2 A12.jpg
0000000 ff d8
$ hexdump A12.jpg
00047c0 17 b2 96 08 0b 42 70 10 38 01 33 45 d0 7f ff d9
Correcting "Windows Installer Service could not be accessed" Problem
When I tried to install Norton Ghost 7.5 on a Windows Small Business Server
(SBS) 2003 server, I received the message below:
The Windows Installer Service could not be accessed.
This can occur if you are running Windows in safe
mode, or if the Windows Installer is not correctly
installed. Contact your support personnel for assistance.
[ OK ]
Windows Installer 3.1 Redistributable (v2) From Microsoft's Download Center
and installed it, but I got the same results when I tried to reinstall
Symantec Ghost 7.5.
"Error 1719: The Windows Installer service could not be accessed" error message
when you try to add or remove a program states the behavior may occur
if the following conditions are true:
- The Windows Installer files that are on your hard disk are damaged or are
- You install or remove a program that uses the Windows Installer Microsoft
Software Installation (MSI) package file (.msi). For example, this may occur
when you try to install Microsoft Office on your computer.
I was starting the Symantec Gost 7.5 installation process from a CD with an
autorun file, but I noticed there was a file, Symantec Ghost.msi in
an Install directory on the CD. The installation process likely uses
file for the installation.
Microsoft's article recommends steps to resolve the problem. You should first
determine the location of the file msiexec.exe on your system. The file
will be in the Windows system32 directory, which is usually either
C:\Windows\system32 or C:\WINNT\system32 for versions of
Windows after Windows 98. For Windows 98 the file is usually in
C:\Windows\System. You can search for
the file or you can determine the
Windows directory by obtaining a command prompt and checking the value of
%WINDIR% environment variable with
which will tell you which directory is the Windows directory on a system.
You can then verify that msiexec.exe is in that directory.
Volume in drive C has no label.
Volume Serial Number is E88C-7773
Directory of C:\Windows\system32
03/21/2005 02:00 PM 78,848 msiexec.exe
1 File(s) 78,848 bytes
You then need to check the registry to make sure that
has a value that corresponds to the actual location of the
msiexec.exe file on the system. You can do so using the
regedit command or using a
reg query command from a command
C:\>reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSIServer
Description REG_SZ Adds, modifies, and removes applications provided a
s a Windows Installer (*.msi) package. If this service is disabled, any services
that explicitly depend on it will fail to start.
Type REG_DWORD 0x20
Start REG_DWORD 0x3
ErrorControl REG_DWORD 0x1
ImagePath REG_EXPAND_SZ C:\Windows\system32\msiexec.exe /V
DisplayName REG_SZ Windows Installer
DependOnService REG_MULTI_SZ RpcSs
ObjectName REG_SZ LocalSystem
If the msiexec.exe file is in C:\Windows\System32, you should
see C:\Windows\System32\Msiexec.exe /V as the value in the key.
In the case of the system I was working on, the file location matched the
If the values don't match, you will need to enter the correct path in the
registry or put the file in the directory listed in the registry. Once the
values match, you will need to reregister the msiexec.exe file.
To do so, restart the computer in Safe Mode (hit F8
to get the menu of boot options before Windows starts when you reboot).
Once you've logged into an administrator account on the system in Safe Mode,
you will need to use the following procedure:
Click Start, click Run, type the following line, and then
Note: For 64-bit operating systems, you also need to reregister the 64-bit MSI
installer. To do this, click Start, click Run, type the
following line, and then click OK:
On 64-bit editions of a Windows operating system, 32-bit binaries are located
in %systemroot%\SysWow64 folder. 64-bit binaries are located in the
Once you have reregistered the msiexec.exe file, you will need
to reboot into standard mode. Then try the installation process again that
failed previously. If that fails, Microsoft does offer another alternative
for dealing with the problem. See "Method 2" at
"Error 1719: The Windows
Installer service could not be accessed" error message when you try to add or
remove a program.
In my case, I was then able to successfully reinstall Symantec Ghost 7.5
on the system, though I did receive another error at the end of the process
that was not associated with the previous installer problem. The error I
received at the end is shown below.
|Symantec Ghost Configuration Server|
08001 [Sybase[[ODBC driver][Adaptive Server Anywhere]Unable to connect to
database server: Database server not running
[ OK ]
Windows Installer 3.1 Redistributable (v2)
Date Published: September 2, 2005
Microsoft Download Center
"Error 1719: The Windows Installer service could not be accessed" error
message when you try to add or remove a program
Article ID : 315346
Last Review : March 1, 2007
Microsoft Help and Support
File Extension Details for .MSI