objective c - crop image from certain portion of screen in iphone programmatically -


एनएसएयूटीओरियसपूल * पूल = [[एनएसएयूटीओरियसपुल आलोक] इनट]; CGSize contextSize = CGSizeMake (320,400); UIGraphicsBeginImageContext (self.view.bounds.size);

<पूर्व> UIGraphicsBeginImageContext (contextSize); [Self.view.layer renderIncontext: UIGraphicsGetCurrentContext ()]; UIImage * savedImg = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext (); [स्व सेटस्वेइज़ेज़: बचाइएग];

मुख्य स्क्रीन से छवि के कुछ भाग को extarct करने के लिए।

UIGraphicsBeginImageContext में मैं केवल आकार का उपयोग कर सकते हैं, CGRect या छवि निकालने के लिए किसी अन्य तरीके का उपयोग करने के लिए कोई रास्ता नहीं है स्क्रीन के एक विशेष भाग से (एक्स, वाई, 320, 400) कुछ इस तरह से

आशा यह मदद करता है:

  // नया चित्र प्रसंग बनाएं (रेटिना सुरक्षित) यूआईजीआरएफ़फ़्रेंसजर्मइज़ेज़ेन्टेन्टेकविथ विकल्प (आकार, नहीं, 0.0); // छवि के लिए रीसेट बनाएं सीजीआरसीआरसीटीआरसीटी = सीजीआरएक्टेक (एक्स, वाई, आकार। वाइड, आकार। हाइट); // छवि को रीक्ट में डालें [मौजूदा इमेज ड्राइनक्ट: रीक्ट]; // छवि को सहेजना, छवि संदर्भ को समाप्त करना UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext ();  

Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -