1

これは私が使用している私のコードです。「drawImage」UIImageViewで行われる描画を使用して、これらのサムネイルを介してビデオを作成した後、サムネイルを生成したいと思います。

   while([self.thunbnailArray count])
    {
        id times = [self.thunbnailArray objectAtIndex:0];////self.thumbnailArray contains duratin of player at which thumbnail generate//////
        [self.thunbnailArray removeObjectAtIndex:0];
        UIImage* thumbnail = [player1 thumbnailImageAtTime:[times floatValue]             timeOption:MPMovieTimeOptionExact];

        UIGraphicsBeginImageContext(drawImage.frame.size);////drawImage is a UIImageView to make drawing
        [drawImage.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

        CGImageRef firstImageRef = thumbnail.CGImage;/////merge thumbnail and drawing both together
        CGFloat firstWidth = CGImageGetWidth(firstImageRef);
        CGFloat firstHeight = CGImageGetHeight(firstImageRef);
        CGSize mergedSize = CGSizeMake(firstWidth, firstHeight);
        UIGraphicsBeginImageContext(mergedSize);
        [thumbnail drawInRect:CGRectMake(0, 0, firstWidth, firstHeight)];
        [viewImage drawInRect:CGRectMake(0, 0, firstWidth, firstHeight)];
        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        [self.imageArray addObject:newImage];///self.imageArray used to generate video

    }
4

0 に答える 0