Save images to App sandbox directory

With Dynamsoft Camera SDK iOS Edition, you can save the data in DcsBuffer as a file to the App sandbox directory using the methods save() or saveAsync(). You can also reload the saved file into the DcsBuffer via the method loadFile.

Below is a simple code snippet:

    @property (nonatomic,strong) DcsPDFEncodeParameter *pdf;
    @property (nonatomic,strong) DcsPNGEncodeParameter *png;
    @property (nonatomic,strong) DcsJPEGEncodeParameter *jpeg;

    _pdf = [[DcsPDFEncodeParameter alloc] init];
    _png = [[DcsPNGEncodeParameter alloc] init];
    _jpeg = [[DcsJPEGEncodeParameter alloc] init];
    
    _jpeg.quality = 0.8;
    
    NSArray *tempArr = [[NSArray alloc]initWithObjects:@"1",@"2",nil]; // @"1" and @"2" are the indices of the second and third data in DcsBuffer.
    [self.dcsView.io save:tempArr file:@"tempname" encodeParameter:_png];

        let png=DcsPNGEncodeParameter()
        let pdf=DcsPDFEncodeParameter()
        let jpg=DcsJPEGEncodeParameter()
        jpg.quality=0.8
        dcsView.io.save([0], file: "temp.png", encodeParameter: png) //0 is the index of the first data in DcsBuffer
Is this page helpful?

Leave a Reply

Your email address will not be published.