debian: บันทึก imagemagick - convert

แปลงรูปจาก jpg ธรรมดา ไปเป็น jpg แบบ interlace
ใช้คำสั่งคือ
# mkdir temp
# for i in *jpg; do convert $i -interlace line temp/$i ; done

จะได้ไฟล์ jpg ชุดใหม่เข้าไปอยู่ในไดเรกทอรี่ temp

แปลงหลายรูป จาก tif ไปเป็น pdf
# convert -adjoin `ls *.tif` newfile.pdf
เอามาจาก jmetrix : Viewing multiple page tif on Linux

แปลง tif หลายไฟล์ไปเป็น tif ไฟล์เดียวหลายภาพ
$ convert x1.tif x2.tif x3.tif -adjoin newfile.tif

แตก tif แบบหลายภาพ ออกมาเป็นหลายไฟล์ ไฟล์ละหนึ่งหน้า
$ convert x.tif x%d.tif
จะได้ออกมาเป็น x1.tif x2.tif x3.tif
เอามาจาก [magick-users] how to split multi-page tiff into single pages

แปลง tif แบบ 8-bit ไปเป็น 4-bit 256 สี เพื่อลดขนาด และสามารถเปิดใน Windows ได้คล่องตัวขึ้น
เทคนิคคือแปลงเป็น gif ก่อน ไม่งั้นแปลงแล้วเปิดไม่ได้
$ convert x.tif /tmp/x.gif
$ convert /tmp/x.gif -depth 4 x.tif

ไฟล์ tif จาก gimp พิมพ์บน evince ไม่ออก
แก้ด้วยการแปลงเป็น jpg ก่อน แล้วจึงแปลงกลับเป็น tif อีกที
$ convert x.tif /tmp/x.jpg
$ convert /tmp/x.jpg x.tif

อีกกรณีหนึ่ง ที่ใช้งานจริง คืองานที่เป็น tif แบบหลายหน้า เราจะกระจายออกมาก่อน แล้วแก้ไขด้วย gimp แล้วจึงรวมกลับเข้าไป โดยต้องการให้ไฟล์เล็กที่สุด คือเป็น gray 256 สี ขนาดภาพ A4 ที่ความละเอียด 200dpi
$ convert x.tif -quality 100 /tmp/x%d.jpg
หลังจากแก้ไขด้วย gimp เสร็จแล้ว ก็ใช้คำสั่ง
$ convert /tmp/*jpg -geometry 1654 -density 200 -compress lzw -depth 4 -adjoin x.tif
ที่มา : My MCP: ImageMagick convert -geometry weirdness

หมายเหตุ
ต้องลงแพกเกจ imagemagick ก่อน
# aptitude install imagemagick

 

Thai Search

Google Search

Custom Search

Theme

Who's online

There are currently 0 users and 10 guests online.