Filestack Documentation

Class Convert​Transform

public class ConvertTransform: Transform  

Converts the image to a different format.

Matrix of supported conversions can be found here: https://cdn.filestackcontent.com/UPqbkTIETnGaQJa1nqnG?dl=true

ConvertTransform ConvertTransform Transform Transform ConvertTransform->Transform

Superclass

Transform

:nodoc:

Initializers

init()

public init()  

Initializes a ConvertTransform object.

Methods

format(_:​)

@discardableResult
    func format(_ value: TransformFiletype) -> Self  

Adds the format option.

Parameters

value Transform​Filetype

The format to which you would like to convert the file.

background(_:​)

@discardableResult
    func background(_ value: UIColor) -> Self  

Adds the background option.

Parameters

value UIColor

Set a background color when converting transparent .png files into other file types.

page(_:​)

@discardableResult
    func page(_ value: Int) -> Self  

Adds the page option.

Parameters

value Int

If you are converting a file that contains multiple pages such as a PDF or PowerPoint file, you can extract a specific page using the page parameter. Valid range: 1...99999

density(_:​)

@discardableResult
    func density(_ value: Int) -> Self  

Adds the density option.

Parameters

value Int

You can adjust the density when converting documents like PowerPoint, PDF, AI and EPS files to image formats like JPG or PNG. Valid range: 1...500

compress()

@discardableResult
    func compress() -> Self  

Adds the compress option. Takes advantage of Filestack's image compression which utilizes JPEGtran and OptiPNG.

quality(_:​)

@discardableResult
    func quality(_ value: Int) -> Self  

Adds the quality option.

Parameters

value Int

You can change the quality (and reduce the file size) of JPEG images by using the quality parameter. Valid range: 1...100

preserve​Input​Quality()

@discardableResult
    func preserveInputQuality() -> Self  

Adds the quality option with value set to "input". Used for JPG images if we want output file to have same quality as original one.

strip()

@discardableResult
    func strip() -> Self  

Adds the strip option. Remove embedded file metadata.

color​Space(_:​)

@discardableResult
    func colorSpace(_ value: TransformColorSpace) -> Self  

Adds the colorspace option.

Parameters

value Transform​Color​Space

An TransformColorSpace value.

secure()

@discardableResult
    func secure() -> Self  

Adds the secure option. Applies to conversions of HTML and SVG sources only. When the secure parameter is set to true, the HTML or SVG file will be stripped of any insecure tags.

doc​Info()

@discardableResult
    func docInfo() -> Self  

Adds the docinfo option. Gives information about a document, such as the number of pages and the dimensions of the file. This information is delivered as a JSON object.

page​Format(_:​)

@discardableResult
    func pageFormat(_ value: TransformPageFormat) -> Self  

Adds the pageFormat option.

Parameters

value Transform​Page​Format

An TransformPageFormat value.

page​Orientation(_:​)

@discardableResult
    func pageOrientation(_ value: TransformPageOrientation) -> Self  

Adds the pageOrientation option.

Parameters

value Transform​Page​Orientation

An TransformPageOrientation value.