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.

DSImageManager

The DSImageManager class is a utility class for managing and manipulating images. It provides functionality for saving images to files and drawing various shapes on images.

Definition

Assembly: DynamsoftUtility.framework

  • Objective-C
  • Swift
  1. @interface DSImageManager : NSObject
    
  2. class ImageManager : NSObject
    

Methods

Method Description
saveToFile Saves an image to the specified path and format.
drawOnImage(image,quads,colour,thickness) Add quadrilaterals on the image.
drawOnImage(image,lines,colour,thickness) Add lines on the image.
drawOnImage(image,contours,colour,thickness) Add contours on the image.
drawOnImage(image,corners,colour,thickness) Add corners on the image.
drawOnImage(image,edges,colour,thickness) Add edges on the image.

saveToFile

Saves an image to the specified path and format. The desired file format is inferred from the file extension provided in the path parameter.

  • Objective-C
  • Swift
  1. - (BOOL)saveToFile:(DSImageData *)imageData
              path:(NSString *)path
         overWrite:(BOOL)overWrite
             error:(NSError * _Nullable * _Nullable)error;
    
  2. func save(toFile imageData: ImageData, path: String, overWrite: Bool) throws -> Bool
    

Parameters

imageData: The image to be saved, of type ImageData.

path: The file path, name and extension name, as a string, under which the image will be saved.

overWrite: A flag indicating whether to overwrite the file if it already exists. Defaults to true.

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

Error

Error Code Value Description
EC_NULL_POINTER -10002 The ImageData object is null.
EC_FILE_TYPE_NOT_SUPPORTED -10006 The file type is not supported.
EC_FILE_ALREADY_EXISTS -10067 The file already exists but overwriting is disabled.
EC_CREATE_FILE_FAILED -10068 The file path does not exist but cannot be created, or the file cannot be created for any other reason.
EC_IMGAE_DATA_INVALID -10069 The input ImageData object contains invalid parameter(s).

Return Value

A BOOL value that indicates whether the file is saved successfully.

drawOnImage(image,quads,colour,thickness)

Add quadrilaterals on the image.

  • Objective-C
  • Swift
  1. - (DSImageData *)drawOnImage:(DSImageData *)image
                       quads:(NSArray<DSQuadrilateral *> *)quads
                      colour:(UIColor)colour
                   thickness:(NSInteger)thickness;
    
  2. func drawOnImage(_ image: ImageData, quads: [Quadrilateral], colour: UIColor, thickness: Int) -> ImageData
    

    Parameters

image: The ImageData to modify.

quads: An array of Quadrilateral objects to be added on the image.

colour: A UIColor that specifies the targeting colour.

thickness: The width of the border.

Return Value

The modified ImageData.

drawOnImage(image,lineSegments,colour,thickness)

Add lines on the image.

  • Objective-C
  • Swift
  1. - (DSImageData *)drawOnImage:(DSImageData *)image
                lineSegments:(NSArray<DSLineSegment *> *)lineSegments
                      colour:(UIColor)colour
                   thickness:(NSInteger)thickness;
    
  2. func drawOnImage(_ image: ImageData, lineSegments: [LineSegment], colour: UIColor, thickness: Int) -> ImageData
    

    Parameters

image: The ImageData to modify.

lineSegments: An array of LineSegment objects to be added on the image.

colour: A UIColor that specifies the targeting colour.

thickness: The width of the lines.

Return Value

The modified ImageData.

drawOnImage(image,contours,colour,thickness)

Add contours on the image.

  • Objective-C
  • Swift
  1. - (DSImageData *)drawOnImage:(DSImageData *)image
                    contours:(NSArray<DSContour *> *)contours
                      colour:(UIColor)colour
                   thickness:(NSInteger)thickness;
    
  2. func drawOnImage(_ image: ImageData, contours: [Contour], colour: UIColor, thickness: Int) -> ImageData
    

    Parameters

image: The ImageData to modify.

contours: An array of Contour objects to be added on the image.

colour: A UIColor that specifies the targeting colour.

thickness: The width of the borders.

Return Value

The modified ImageData.

drawOnImage(image,corners,colour,thickness)

Add corners on the image.

  • Objective-C
  • Swift
  1. - (DSImageData *)drawOnImage:(DSImageData *)image
                     corners:(NSArray<DSCorner *> *)corners
                      colour:(UIColor)colour
                   thickness:(NSInteger)thickness;
    
  2. func drawOnImage(_ image: ImageData, corners: [Corner], colour: UIColor, thickness: Int) -> ImageData
    

    Parameters

image: The ImageData to modify.

corners: An array of Corner objects to be added on the image.

colour: A UIColor that specifies the targeting colour.

thickness: The width of the lines.

Return Value

The modified ImageData.

drawOnImage(image,edges,colour,thickness)

Add edges on the image.

  • Objective-C
  • Swift
  1. - (DSImageData *)drawOnImage:(DSImageData *)image
                       edges:(NSArray<DSEdge *> *)edges
                      colour:(UIColor)colour
                   thickness:(NSInteger)thickness;
    
  2. func drawOnImage(_ image: ImageData, edges: [Edge], colour: UIColor, thickness: Int) -> ImageData
    

Parameters

image: The ImageData to modify.
edges: An array of DSEdge objects to be added on the image.
colour: A UIColor that specifies the targeting colour.
thickness: The width of the lines.

Return Value

The modified ImageData.

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.13
      • Version 1.1.12
      • 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