Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

DSImageData

The DSImageData class defines the structure of an object that represents an image.

Definition

Assembly: DynamsoftCore.framework

  • Objective-C
  • Swift
  1. @interface DSImageData : NSObject
    
  2. class ImageData : NSObject
    

Attribute Summaries

Attributes Type Description
bytes NSData * The image data content in a byte array.
width NSInteger The width of the image in pixels.
height NSInteger The height of the image in pixels.
stride NSInteger The stride (or scan width) of the image.
format DSImagePixelFormat The image pixel format used in the image byte array.
orientation NSInteger The orientation information of the image. The library is able to read the orientation information from the EXIF data of the image file.
tag DSImageTag * The tag of the image.

Method Summaries

Method Description
toUIImage Transform the DSImageData to a UIImage.

Attribute Details

bytes

The image data content in a byte array.

  • Objective-C
  • Swift
  1. @property(nonatomic, copy) NSData *bytes;
    
  2. var bytes: Data? { get set }
    

width

The width of the image in pixels.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) NSInteger width
    
  2. var width: Int { get set }
    

height

The height of the image in pixels.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) NSInteger height
    
  2. var height: Int { get set }
    

stride

The stride (or scan width) of the image.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) NSInteger stride
    
  2. var stride: Int { get set }
    

format

The image pixel format used in the image byte array.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) DSImagePixelFormat format
    
  2. var format: DSImagePixelFormat { get set }
    

orientation

The orientation information of the image. The library is able to read the orientation information from the EXIF data of the image file.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) NSInteger orientation
    
  2. var orientation: Int { get set }
    

tag

The tag of the image.

  • Objective-C
  • Swift
  1. @property(nonatomic, strong, nullable) DSImageTag *tag;
    
  2. var tag?: DSImageTag { get set }
    

Method Details

toUIImage

Transform the DSImageData to a UIImage.

  • Objective-C
  • Swift
  1. - (UIImage * _Nullable)toUIImage:(NSError *_Nullable *_Nullable)error;
    
  2. func toUIImage() throws -> UIImage
    

Parameters

error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_BPP_NOT_SUPPORTED -10007 The pixel format is not supported or the ImageData is invalid.

Return Value

A UIImage that converted from the DSImageData.

Code Snippet

  • Objective-C
  • Swift
  1. NSError *error;
    UIImage *image = [imageData toUIImage:&error];
    
  2. do{
       image = try imageData.toUIImage()
    } catch{
       // Add your code to deal with exceptions.
    }
    

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    • Version 2.x
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
    • Version 1.x
      • Version 1.2.1
      • Version 1.2.0
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
      • Version 1.1.11
      • Version 1.1.9
      • Version 1.1.8
      • Version 1.1.7
      • Version 1.1.6
      • Version 1.1.5
      • Version 1.1.4
      • Version 1.1.3
      • Version 1.1.2
      • Version 1.1.1
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support