This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIRECTORY = "/videos/" | |
Dir.foreach(DIRECTORY) { |file| | |
next if !file.end_with?(".mov") | |
new_file = file.sub(".mov",".mp4") | |
puts "converting #{file} into #{new_file} ... \n" | |
%x{HandBrakeCLI -Z HigherProfile --strict-anamorphic --crop "0:0:0:0" -i "#{DIRECTORY}#{file}" -o "#{DIRECTORY}#{new_file}" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CIContext *context = [CIContext contextWithOptions:nil]; | |
UIImage *entryImage = [UIImage imageNamed:@"someImage.png"]; | |
CIImage *image = [CIImage imageWithCGImage:[entryImage CGImage]]; | |
CIFilter *filter = [CIFilter filterWithName:@"CIMaskToAlpha"]; | |
[filter setValue:image forKey:kCIInputImageKey]; | |
CIImage *result = [filter valueForKey:kCIOutputImageKey]; | |
CGImageRef cgImage = [context createCGImage:result fromRect:[result extent]]; | |
UIImage *newImage = [UIImage imageWithCGImage:cgImage scale:[entryImage scale] orientation:UIImageOrientationUp]; |