 		alignImageAtCenter()
 	}
 	
-	func createBackgroundImage(inputImage input:UIImage)->UIImage
+	func createBackgroundImage(inputImage input:UIImage)->UIImage?
 	{
 		let bounds = UIScreen.mainScreen().bounds
-		let size = bounds.size
+		let size = CGSizeMake(bounds.width / 2.0, bounds.height / 2.0)
 		
 		let scale = max(size.width / input.size.width, size.height / input.size.height)
 		
-		UIGraphicsBeginImageContextWithOptions(size, false, 1.0 / scale)
-		input.drawInRect(bounds)
+		UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
+		let context = UIGraphicsGetCurrentContext()
+		
+		CGContextScaleCTM(context, scale, scale)
+		
+		let tx = (size.width / scale - input.size.width) / 2.0
+		let ty = (size.height / scale - input.size.height) / 2.0
+		CGContextTranslateCTM(context, tx, ty)
+		
+		input.drawAtPoint(CGPointMake(0, 0))
 		
 		var data:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
 
 		UIGraphicsEndImageContext()
 		
 		var filter = CIFilter(name: "CIGaussianBlur")
-		filter.setValue(data.CIImage, forKey: kCIInputImageKey)
-		filter.setValue(10.0, forKey: kCIInputRadiusKey)
-		return UIImage(CIImage: filter.outputImage)!
+		filter.setValue(CIImage(image: data), forKey: kCIInputImageKey)
+		filter.setValue(20.0, forKey: kCIInputRadiusKey)
+		return UIImage(CIImage: filter.outputImage)
 	}
 	
 	func doubleTapZoom(gesture:UITapGestureRecognizer)

	{
		super.viewDidLoad()
		
		scroll = UIScrollView()
		scroll.frame = UIScreen.mainScreen().applicationFrame;
		scroll.contentSize = scroll.frame.size
		scroll.minimumZoomScale = 0.01
		scroll.maximumZoomScale = 2.00
		scroll.delegate = self
		
		background = UIImageView()
		view.addSubview(background)
		view.addSubview(scroll)
		
		scroll.pinchGestureRecognizer.addTarget(self, action: "pinchUpdated:")

	
	override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation)
	{
		repairImageZoom()
		alignImageAtCenter()
	}
	
	func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView?
