# mkdir temp
# for i in *jpg; do convert $i -interlace line temp/$i ; done# convert -adjoin `ls *.tif` newfile.pdf$ convert x1.tif x2.tif x3.tif -adjoin newfile.tif$ convert x.tif x%d.tifหมายเหตุ
ต้องลงแพกเกจ imagemagick ก่อน
# aptitude install imagemagick
ยังหาโปรแกรมที่ใช้แก้ไขภาพ tif แบบหลายหน้า แบบ Imaging for Windows บนลินุกซ์ไม่ได้
ก็คงต้องใช้แบบบรรทัดคำสั่งไปพลาง ๆ ก่อน
ขั้นตอนคือ
ต้องลง ImageMagick ก่อน
$ sudo aptitude install imagemagick
แตกไฟล์ tif แบบหลายหน้าออกมาเป็น แบบหน้าเดียวหลายไฟล์
$ convert image.tif x%d.tif
แก้ไขหน้าที่ต้องการจากไฟล์ที่แตกออกมาแล้ว ด้วย gimp สมมุติว่าเป็นหน้า 2
$ gimp x2.tif
เมื่อบันทึกเรียบร้อยแล้ว ก็รวมกลับเป็นไฟล์เดียวตามเดิม สมมุติว่ามีทั้งหมด 3 ไฟล์
$ convert x1.tif x2.tif x3.tif -adjoin newimage.tif
ถ้าจะให้บีบอัดด้วย
$ convert newimage.tif -compress lzw newimage.tif$ convert newimage.tif -compress fax newimage.tifสำหรับการบีบอัดมีพารามิเตอร์คือ None BZip Fax Group4 JPEG JPEG2000 Lossless LZW RLE และ Zip
ต้องทดลองเลือกใช้ดูให้เหมาะกับประเภทของภาพ
ลยไฟล์ย่อยทิ้ง
$ rm x?.tif
ดูผลได้ด้วย evince
$ evince newimage.tif
อ้างอิง : debian: บันทึก imagemagick - convert
*** โปรดระวัง - ไม่สามารถใช้กับไฟล์ tif ที่มีข้อมูล annotation ได้ ***
update
จากขั้นตอนข้างบน สามารถนำมาเขียนสคริปต์ทำให้ใช้คำสั่งเดียวได้ ดังนี้
สมมุติว่าจะต้องการแก้ไข image.tif ในหน้า 0 และหน้า 1 สั่งจากสคริปต์ว่า
$ d.edittif image.tif 0 1
gimp จะเปิดไฟล์ออกมา 2 ไฟล์ คือหน้าแรก และหน้าที่สอง
หลังจากบันทึกและปิด gimp แล้ว จะได้ไฟล์ image-new.tif ออกมาเป็นภาพที่แก้ไขแล้วพร้อมบีบอัดเรียบร้อย
เนื้อไฟล์ d.edittif มีดังนี้
$ sudo touch /usr/local/bin/d.edittif
$ sudo chmod 755 /usr/local/bin/d.edittif
$ sudo vi /usr/local/bin/d.edittif
#!/bin/bash
# EDIT MULTIPLE PAGES TIF FILE
# PREREQUIST: gimp imagemagick evince
#NAME=${0##*/}
NAME=`basename $0`
USAGE=" Usage: $NAME FILE PAGE0 PAGE1 ...
ex1: $NAME image.tif 0 1 = Edit file image.tif on PAGE0 and PAGE1"
phelp()
{
echo "$NAME: edit multiple pages tif.
$USAGE"
}
while getopts "h" opt; do
case "$opt" in
h) phelp; exit 0;;
*) echo "$Usage" 1>&2; exit 2;;
esac
done
shift $((OPTIND - 1))
if [ ! $2 ]; then
phelp
exit 1;
fi
TIF=$1
shift
FILE=${TIF%.*} #STRIP FILENAME
EDITFILE=”"
while [ $1 ]; do
EDITFILE=”$EDITFILE ~${FILE}$1.tif”
shift
done
ALLFILE=`ls ~${FILE}*.tif`
if [ -f $TIF ]; then
echo “Process $TIF”
/usr/bin/convert $TIF “~$FILE%d.tif”
if [ -f "~${FILE}0.tif" ]; then
#EDIT WITH gimp
echo “Edit $EDITFILE”
/usr/bin/gimp $EDITFILE
#COMPRESS EACH TIF
for i in $ALLFILE; do
echo -n “IDENTIFY $i ”
if /usr/bin/identify -verbose $i | grep “Gray: 1-bits”; then
/usr/bin/convert $i -compress fax $i
else
/usr/bin/convert $i -compress lzw $i
fi
done
/usr/bin/convert $ALLFILE -adjoin -compress lzw “$FILE-new.tif” #COMPRESS & JOIN
/usr/bin/evince “$FILE-new.tif” #VIEW NEW FILE
rm $ALLFILE #DELETE ALL SPLIT FILE
fi
fi
ลองบนเดเบียน sid ครับ
ความจำเป็นบีบบังคับให้ต้องรีบหาโปรแกรมที่สามารถทำ Annotation ไฟล์ tif ให้ได้
จริง ๆ ก็มีโปรแกรมชื่อ Xournal ที่สามารถทำ annotate บน pdf ได้
ซึ่งเราอาจแปลง tif ไปเป็น pdf ก่อน แล้วจึงค่อยลงมือแก้ไข
แต่พบว่าในรุ่นปัจจุบันบน sid คือ 0.3.3 ยังทำ Text annotation ไม่ได้
และรุ่นล่าสุด 0.4 ความสามารถและการใช้งานยังค่อนข้างด้อยกว่าที่ Kodakimg ทำได้อยู่โข
แต่จากครั้งก่อนที่ทำ การแก้ไข multiple pages tif
คราวนี้เลยได้ความคิดว่าถ้าลองเปลี่ยนจาก Gimp มาเป็น Inkscape เราก็จะได้ความสามารถในการทำ annotation จาก inkscape ในแบบที่ก้าวหน้าสุด ๆ
มีปัญหาที่ต้องแก้คือ inkscape ไม่สามารถแก้ไขไฟล์แบบหลายหน้าได้ (แต่ในอนาคตคงมาแน่ ๆ เห็นอยู่ใน wishlist ลำดับต้น ๆ )
ทางแก้แบบชั่วคราวคือ กระจายไฟล์ลงในไดเรคทอรี่ชั่วคราวที่สร้างไว้ แล้วแก้ไขตามไฟล์ที่เราระบุ
อีกปัญหาคือเวลาแปลงกลับจาก svg มาเป็น tif แบบหลายหน้าแล้ว ข้อมูล annotation ที่เราทำไว้ จะถูกแปลงเป็นข้อมูล bitmap ฝังรวมกับไฟล์ tif ไปหมด
ทางแก้ชั่วคราวอีกเหมือนกันคือ ให้คงไดเรกทอรี่ชั่วคราวนี้ไว้ โดยไม่ลบไฟล์ทิ้งเลย เมื่อเวลาเราใช้คำสั่ง annotate ครั้งใหม่ เขาก็จะมาแก้ไขต่อจากที่เราเคยแก้เอาไว้ โดยต้องยอมรกรุงรังบ้าง
เนื้อแบตช์ไฟล์มีดังนี้
$ sudo vi /usr/local/bin/d.tifannotate
#!/bin/bash
# ANNOTATE MULTIPLE PAGES TIF FILE
# PREREQUIST: inkscape imagemagick evince
#NAME=${0##*/}
NAME=`basename $0`
USAGE=" Usage: $NAME FILE PAGE0 PAGE1 ...
ex1: $NAME image.tif 0 1 = Edit file image.tif on PAGE0 and PAGE1"
phelp()
{
echo "$NAME: annotate multiple pages tif.
$USAGE"
}
while getopts "h" opt; do
case "$opt" in
h) phelp; exit 0;;
*) echo "$Usage" 1>&2; exit 2;;
esac
done
shift $((OPTIND - 1))
if [ ! $2 ]; then
phelp
exit 1;
fi
TIF=$1
shift
FILE=${TIF%.*} #STRIP FILENAME
TEMPDIR=”${FILE}~”
EDITFILES=”"
while [ $1 ]; do
EDITFILES=”$EDITFILES ${FILE}$1.svg”
shift
done
INKSCAPE=`which inkscape`
IDENTIFY=`which identify`
CONVERT=`which convert`
VIEW=`which evince`
if [ -f $TIF ]; then
echo “Process $TIF”
#TEST TEMP DIR EXIST
if ! [ -d $TEMPDIR ]; then
#CREATE TEMP DIR AND SPLIT tif INTO
mkdir $TEMPDIR
$CONVERT $TIF “${TEMPDIR}/$FILE%d.tif”
#ENTER WORKING TEMP DIR
pushd $TEMPDIR
ALLFILE=`ls ${FILE}*.tif`
#CONVERT TO svg
for i in $ALLFILE; do
$INKSCAPE -l “${i%.*}.svg” $i
done
else
#ELSE; EDIT OLD svg
pushd $TEMPDIR
fi
#ANNOTATE
if [ -f "${FILE}0.svg" ]; then
#ANNOTATE WITH inkscape
echo “Edit $EDITFILES”
$INKSCAPE $EDITFILES
ALLSVG=`ls ${FILE}*.svg`
#CONVERT ADJOIN
$CONVERT $ALLSVG -adjoin -compress lzw “$FILE-new.tif” #COMPRESS & JOIN
$VIEW “$FILE-new.tif” #VIEW NEW FILE
mv “$FILE-new.tif” ..
fi
#EXIT WORK DIR
popd
#REMOVE DIR
#rm -rf $TEMPDIR
fi
$ sudo chmod 755 /usr/local/bin/d.tifannotate
เรียกใช้งานด้วยคำสั่ง… โปรแกรม ไฟล์tif หน้าที่ต้องการแก้ไข
$ d.tifannotate FILE.tif 0 1 ...
จะได้ไฟล์ที่ทำ annotate แล้วชื่อ FILE-new.tif และไดเรกทอรี่ชั่วคราวชื่อ FILE~ เหลืออยู่ เพื่อใช้ในการแก้ไขครั้งต่อไป (แต่ถ้าไม่ได้ใช้แน่ ๆ ก็อาจเติมคำสั่งลบต่อท้ายแบตช์ไฟล์ หรือลบด้วยมือเอาทีหลังก็ได้ครับ)
กระท่อนกระแท่นหน่อย เพราะเป็นการทำเพื่อรอโปรแกรมลินุกซ์แนวนี้ในอนาคตตัวจริง ก็พอใช้งานได้ไปพลาง ๆ ก่อนครับ
อย่าลืม เปลี่ยนขนาดกระดาษไน inkscape ด้วย
แต่ติดใจการใช้งาน annotation บน inkscape จริง ๆ แฮะ
Demo
move magnifer to see zoom images
Loupe.js and Loupe.png allows you to add a loupe (magnifier) to images on your webpages.
It uses unobtrusive javascript to keep your code clean.
It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, IE 6+ and Safari. On older browsers, it’ll degrade and your visitors won’t notice a thing.
how to use
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="expires" content="Fri, 27 Jul 2007 12:00:00 GMT">
<meta http-equiv="imagetoolbar" content="no">
<title>Caribbean</title>
<script type="text/javascript">
// path to "loupe.png"
// var loupePath = "";
</script>
<script src="loupe.js" type="text/javascript"></script>
<!--[if gte IE 6]>
<script type="text/javascript">
var loupePath = "vml/";
</script>
<script src="vml/loupe.js" type="text/javascript"></script>
<![endif]–>
<style type="text/css">
body {
margin: 0;
padding: 0;
font-family: georgia,serif;
font-style: italic;
color: gray;
background: white;
}
#content {
padding: 0;
margin-left: 84px;
margin-top: 40px;
width: 550px;
}
#header {
font-weight: normal;
}
</style>
</head>
<body>
<div id="content">
<h2 id="header">Where are the Pirates of the Caribbean?</h2>
<div style="float: left; width:356px; height:205px; background:url(images/caribbean/small.jpg)
no-repeat; border:1px solid gray; margin-right: 1em; margin-bottom: 0.25em;">
<img id="caribbean" onLoad="initLoupe(this.id,true,773,364);" src="images/caribbean/big.jpg"
style="cursor:wait;" width="356" height="205" alt="large image" border="0" />
</div><small>
</small></div>
</body>
</html>
more info
http://www.netzgesta.de/loupe/
Demo
Xray
Demo
Reflex.js 1.2 allows you to add a Cover Flow? effect (including reflection) to images on your webpages. *Cover Flow is a trademark of Apple Inc.. It uses unobtrusive javascript to keep your code clean.
It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it’ll degrade and your visitors won’t notice a thing.
How to use
<html>
<head>
<title>Reflex.js (with IE 6/7 support)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-language" content="en">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript" src="reflex.js"></script>
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
.demo { float: left; padding: 5px; }
</style>
</head>
<body>
<div class="demo"><a href="images/left.jpg">
<img src="images/left.jpg" width="200" class="reflex iopacity50" alt="" /></a>
<small><br>"<tt>reflex iopacity50</tt>"</small></div>
<div class="demo"><a href="images/none.jpg">
<img src="images/none.jpg" width="200" class="reflex iopacity75" alt="" /></a>
<small><br>"<tt>reflex iopacity75</tt>"</small></div>
<div class="demo"><a href="images/right.jpg">
<img src="images/right.jpg" width="200" class="reflex iopacity25" alt="" /></a>
<small><br>"<tt>reflex iopacity25</tt>"</small></div>
</body>
</html>
More info
http://www.netzgesta.de/reflex/
Demo
Filmed.js 1.1 allows you to add film strips and shadow to images on your webpages (alternatively: slided.js). It uses unobtrusive javascript to keep your code clean.
It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, IE6+ and Safari. On older browsers, it’ll degrade and your visitors won’t notice a thing.
How to use
<html> <head> <title>Filmed.js (with IE 6/7 support)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-language" content="en"> <meta http-equiv="imagetoolbar" content="no"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <script type="text/javascript" src="filmed.js"></script> <meta http-equiv="Content-Style-Type" content="text/css"> </head> <body> <table summary=""> <tr><td valign="top" style="padding-bottom: 1em; white-space: nowrap;"> <img src="images/film.jpg" border="0" class="filmed ishine30" alt="" /> </td> <td style="padding: 0 0 0 15px; margin: 0; line-height: 1.5; font-style: italic;"> <img src="images/girl.jpg" class="filmed ishadow50"> </td></tr> </table> </body> </html>
More info
http://www.netzgesta.de/filmed/
Glossy.js 1.4 allows you to add corners and shading and shadow to images on your webpages (alternatively: corner.js). It uses unobtrusive javascript to keep your code clean.
It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it’ll degrade and your visitors won’t notice a thing.
CVI-lab: Get a fast impression of the effects and their illustration qualities.
how to use
<html>
<head>
<title>Glossy.js (with IE 6/7 support)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-language" content="en">
<script type="text/javascript" src="glossy.js"></script>
<style type="text/css">
<!--
.style {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; }
-->
</style>
</head>
<body>
<table>
<tr>
<td align="center" valign="middle">
<span class="style"><img src="images/3.jpg" border="0"><br>
not use</span></td>
<td align="center" valign="middle"><span class="style">
<img src="images/3.jpg" border="0" class="glossy" alt="glossy.js"><br>
use</span></td>
</tr>
</table>
</body>
</html>
more info
http://www.netzgesta.de/glossy/
Statistics