Nggunakake REST API ing Swift, pangembang bisa ngompres JPG kanthi program. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.
Nggunakake Swift API sing kuat, pangembang bisa ngompres JPG kanggo ngoptimalake isi lan ukuran file output. Ngurangi ukuran file dumadi kanthi ngresiki data lan sumber daya sing ora digunakake. Sampeyan uga bisa compress gambar kanggo nggawe ukuran file output malah luwih cilik.
Asil optimasi lan kompresi isi bisa disimpen ing JPG asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.
Kaya sing wis kasebut, SDK Swift kita ngidini sampeyan nyuda ukuran JPG kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres JPG ing Swift kanthi conto ing ngisor iki:
import AsposeWordsCloud
let config = Configuration(clientId: "####-####-####-####-####",
clientSecret: "##################");
let api = try WordsAPI(configuration: config);
let requestDocument = InputStream(url: URL(string: "Input.jpg"))!;
let requestCompressOptions = CompressOptions()
.setImagesQuality(imagesQuality: 75)
.setImagesReduceSizeFactor(imagesReduceSizeFactor: 1);
let compressDocumentRequest = CompressDocumentOnlineRequest(
document: requestDocument, compressOptions: requestCompressOptions);
let compressDocument = try api.compressDocumentOnline(request: compressDocumentRequest);
let convertDocument = ConvertDocumentRequest(
document: compressDocument.document.values.first, format: "jpg");
_ = try api.convertDocument(request: convertDocument);
Sampeyan bisa nggunakake manajer paket Swift lan manajer dependensi Cocoapods kanggo nginstal Aspose.Words Cloud SDK for Swift. Informasi rinci babagan nginstal paket diwenehi ing bagean "Installation and Usage".
Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Swift saka GitHub lan nggunakake ing project.
Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Swift 4.2 utawa luwih anyar
Deleng Repository Documentation kanggo ndeleng rincian liyane.
Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane: