Skip to content

Instantly share code, notes, and snippets.

@tsuyukimakoto
Created August 9, 2014 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsuyukimakoto/40dc7b960cafb9bf5af4 to your computer and use it in GitHub Desktop.
Save tsuyukimakoto/40dc7b960cafb9bf5af4 to your computer and use it in GitHub Desktop.
Convert raw, or any image, to tiff format image file.
import Foundation
import Cocoa
for arg in Process.arguments[1...Process.arguments.count - 1] {
let fpath = arg.stringByExpandingTildeInPath
let outpath = fpath.stringByDeletingPathExtension + ".tiff"
let im:NSImage = NSImage(contentsOfFile: fpath)
let imageData = im.TIFFRepresentation
imageData!.writeToFile(outpath, atomically:true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment