Friday, September 3, 2010

Merge JPG


不去查一下也真的不知道,原來Linux在處理一些看似簡單的圖片task時,竟然比Windows容易得多!

How to merge JPG Files?

Linux:
  1. Convert a pair of JPEGs into PPM bitmaps, for use by "ppmcat"
    djpeg photo1.jpg > photo1.ppm
    djpeg photo2.jpg > photo2.ppm
  2. Concatenate the photos together, into a new PPM bitmap
    pnmcat -leftright photo1.ppm photo2.ppm > bigphoto.ppm
  3. Concvert the new PPM back into a JPEG
    cjpeg bigphoto.ppm > bigphoto.jpg
  4. Clean up!
    rm photo1.ppm photo2.ppm bigphoto.ppm

Windows using GIMP:
  1. Open the first image
  2. Open the second image
  3. Determine the total size you need your new image to be, depending on how you want them laid out. One next to the other? One on top of another? A 2x2 grid of four images? Et cetera...
  4. Resize one of the images to this new size
  5. Copy the second image
  6. Paste the second image into the first
  7. 'Anchor' the second image into the first's background layer
  8. Save your NEW image


結論:假如要處理100個JPG files呢?用Windows來手動基本上不可能,但用Linux寫一個script便搞掂了.

No comments:

Post a Comment