[OS X TeX] Creating a dvi file
Peter Dyballa
Peter_Dyballa at Web.DE
Tue Apr 17 22:23:36 CEST 2007
Am 17.04.2007 um 15:46 schrieb Bruno Voisin:
> I got the impression the default units were TeX's big points (1/72
> inch) for identify, and pixels for sips, and I thought the two
> units were identical on the Mac by default.
Oh yes! I did not think of this, I have my own script that uses sips
and computes the big points etc., because the sips command is too
long to handle easily in a shell. I'll attach an excerpt to this eMail.
The pixel files (PNG, TIFF, GIF, JPEG) record their size in pixels.
These values are easily read from standard positions in the file.
With the picture's resolution in x and y, of course also recorded in
the file, one can compute the actual size in mm, inches, big points.
> Or does it depend on the chosen resolution in System Preferences >
> Monitor?
In System Preferences you cannot set the resolution of your system's
screen(s), only its (their) size in pixels. For Apple 72 DPI is /the/
standard (did you never adjust the screen's resolution in Mozilla etc?).
BTW, I have a 144 DPI PNG file that ImageMagick's identify does not
compute correctly ...
#!/bin/csh -f
#
# @(#) size.csh
# created: 2005-06-16 {22:33:44}
# last update: Time-stamp: <2007-04-17 22:05:59 pete>
# version: 1.25
#
# Copyright © Pete, Peter_Dyballa at Web dot DE, 2007. Public domain/
Free software.
#
# Tell me the size of a picture!
#
set i=1
set values=`sips --getProperty pixelWidth --getProperty pixelHeight --
getProperty dpiWidth --getProperty dpiHeight "$1" | tr -d :`
#
while ( $i < $#values )
set val=$values[$i]
switch( $val )
case pixelWidth:
@ i++
set X=$values[$i]
breaksw
case pixelHeight:
@ i++
set Y=$values[$i]
breaksw
case dpiWidth:
@ i++
set dX=$values[$i]
breaksw
case dpiHeight:
@ i++
set dY=$values[$i]
breaksw
default:
@ i++
breaksw
endsw
end
set width=`echo "${X} * 72 / $dX" | bc -s`
set height=`echo "${Y} * 72 / $dY" | bc -s`
# for mm
#set width=`echo "scale = 3; $X * 72.27 / $dX / 25.4" | bc -s`
#set height=`echo "scale = 3; $Y * 72.27 / $dY / 25.4" | bc -s`
echo "Your image is ${width} × ${height} (width × heigh) TeX big
points in size."
#72.27 / 25.4 = 2.845275
--
Greetings
Pete
We are usually convinced more easily by reasons we have found
ourselves than by those which have occurred to others.
(Blaise Pascal)
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the macostex-archives
mailing list