Kompres JPG ing C++ SDK

Ngurangi ukuran JPG nggunakake C++

Nggunakake REST API ing C++, pangembang bisa ngompres JPG kanthi program. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.

Ndeleng potongan kode

Compress JPG ing C++

Nggunakake C++ 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.

Ngurangi ukuran JPG file ing C++

Kaya sing wis kasebut, SDK C++ kita ngidini sampeyan nyuda ukuran JPG kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres JPG ing C++ kanthi conto ing ngisor iki:

Unggah file sing pengin dioptimalake / kompres
Kode roto
Pilih format target saka dhaptar
using namespace aspose::words::cloud;

auto config = std::make_shared<ApiConfiguration>(L"####-####-####-####-####",
   L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);

auto requestDocument = std::shared_ptr<std::istream>(
   new std::ifstream(std::filesystem::path(L"Input.jpg"), std::istream::binary));
auto requestCompressOptions = std::make_shared<aspose::words::cloud::models::CompressOptions>();
requestCompressOptions->setImagesQuality(std::make_shared<int32_t>(75));
requestCompressOptions->setImagesReduceSizeFactor(std::make_shared<int32_t>(1));
std::shared_ptr<requests::CompressDocumentOnlineRequest> compressDocumentRequest(
    new requests::CompressDocumentOnlineRequest(
        requestDocument, requestCompressOptions
    )
);
auto compressDocument = wordsApi->compressDocumentOnline(compressDocumentRequest);

auto requestDocument = std::shared_ptr<std::istream>(
   compressDocument->document->values.begin, std::istream::binary));
std::shared_ptr<requests::ConvertDocumentRequest> convertDocument(
    new requests::ConvertDocumentRequest(
        requestDocument, std::make_shared<std::wstring>(L"jpg")
    )
);
wordsApi->convertDocument(convertDocument);
Kode roto
  
Nyalin kode C++ menyang clipboard

Carane ngompres JPG ing C++

  1. Pasang Aspose.Words Cloud for C++
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek C++ sampeyan
  3. Konfigurasi API nggunakake tombol app
  4. Muat sumber JPG kanggo ngompres
  5. Kompres JPG, ngresiki informasi sing ora digunakake
  6. Pilih format file output
  7. Entuk asil kompresi JPG minangka file sing kapisah

Pustaka C++ kanggo nggunakake kompresi JPG.

Klone Aspose.Words Cloud SDK for C++ kode sumber saka GitHub. Sampeyan bisa nemokake informasi rinci babagan mbangun lan ngonfigurasi SDK ing bagean "How to use the SDK".

Kanggo entuk kredensial keamanan sing dibutuhake lan ngakses REST API kanthi cepet, tindakake Instructions iki ing dokumentasi.

Requirements Sistem

Deleng Repository Documentation kanggo ndeleng rincian.

Format file liyane sing didhukung

Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.