Guest User

Untitled

a guest
Feb 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. # Sips Flatten Filter for nanoc 2.1.1
  2. #
  3. # Uses the 'sips' command line tool in Mac OS X to flatten Fireworks images
  4. # Quick hack, use at your own risk. Don't blame us if it destroys your carefully
  5. # crafted images
  6.  
  7. module Nanoc::BinaryFilters
  8.  
  9. class SipsFlattenFilter < Nanoc::BinaryFilter
  10.  
  11. identifier :sips_flatten
  12.  
  13. def run(file)
  14. # Get temporary file path
  15. tmp_file = Tempfile.new("sips_filter")
  16.  
  17. flatten_format = @asset_rep.flatten_format || "png"
  18.  
  19. %x(sips -s format #{flatten_format} #{file.path} --out "#{tmp_file.path}">&/dev/null)
  20.  
  21. tmp_file
  22. end
  23. end
  24.  
  25. end
Add Comment
Please, Sign In to add comment