Iki minangka solusi profesional kanggo ngoptimalake lan ngompres TIFF ing C++. Gunakake C++ kanggo maksimalake kacepetan optimasi/komprèsi TIFF. Coba online gratis!
Nggawe TIFF file gedhe luwih cilik tanpa mundhut kualitas. Mbusak data sing ora perlu lan ora digunakake. Nyilikake ukuran TIFF file ing kode. Pustaka C++ nyedhiyakake pangembang API terpadu kanggo ngoptimalake isi TIFF.
Perpustakaan C++ minangka solusi mandiri lan ora mbutuhake piranti lunak pihak katelu sing diinstal.
Kompresi lossless lan optimasi isi jero digawe gampang karo 'Aspose.Words for C++'. Conto ing ngisor iki nuduhake carane ngoptimalake isi TIFF file ing C++:
dotnet add package Aspose.Words.Cpp
Nyalin
using namespace Aspose::Words;
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto shape = builder->InsertImage(u"Input.tiff");
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
saveOptions->set_TiffCompression(TiffCompression::Lzw);
shape->GetShapeRenderer()->Save(u"Output.tiff", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.tiff");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Iku nganti pangembang kanggo milih perpustakaan kanggo komprèsi gambar.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// Compress gambar lan nyetel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_CacheBackgroundGraphics(true);
doc->Save(u"Output.tiff", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.tiff");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Terserah pangembang kanggo milih perpustakaan kanggo kompresi gambar.
auto image = System::Drawing::Image::Fromstream(shape->get_ImageData()->ToStream());
// ...
// Kompres gambar lan setel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
doc->Save(u"Output.tiff");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.tiff");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Iku nganti pangembang kanggo milih perpustakaan kanggo komprèsi gambar.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// Compress gambar lan nyetel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
auto saveOptions = MakeObject<OoxmlSaveOptions>();
saveOptions->set_CompressionLevel(CompressionLevel::Maximum);
doc->Save(u"Output.tiff", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto shape = builder->InsertImage(u"Input.tiff");
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
saveOptions->set_TiffCompression(TiffCompression::Lzw);
shape->GetShapeRenderer()->Save(u"Output.tiff", saveOptions);
Ana telung opsi kanggo nginstal Aspose.Words for C++ kanggo lingkungan pangembang. Pilih salah siji sing cocog karo kabutuhan sampeyan lan tindakake pandhuan langkah demi langkah:
Sampeyan bisa nggunakake perpustakaan C++ iki kanggo nggawe piranti lunak ing Microsoft Windows, Linux lan macOS:
Yen sampeyan nggawe piranti lunak kanggo Linux utawa macOS, priksa informasi babagan katergantungan perpustakaan tambahan (fontconfig lan paket sumber terbuka mesa-glu) ing Dokumentasi Produk.
Sampeyan bisa ngoptimalake file ing akeh format file liyane: