免費在線將 JPG 合併為 JPG

在線將 JPG 合併為 JPG

使用我們免費的在線 JPG 合併工具輕鬆將 JPG 合併為 JPG。通過幾個步驟將多個 JPG 圖像組合成一個 JPG。

如何將 JPG 合併為 JPG

  • 上傳要合併的 JPG 圖像。
  • 選擇合併模式,即垂直、水平或網格。
  • 選擇輸出格式並開始合併。
  • 完成後,輸出文件將可供下載。

根據需要組合任意數量的 JPG 圖像。將掃描的文檔、照片或任何其他 JPG 圖像合併到一個文件中。生成所需格式的合併 JPG 圖像輸出,例如 JPG、PNG、PDF、DOCX 等。無需安裝 JPG 到 JPG 合併軟件。

只需打開此 100% 免費的在線 JPG 合併,即可將 JPG 高質量地合併為 JPG。您上傳的 JPG 圖片會在 24 小時後安全保存並從我們的服務器中刪除。因此,我們提供了額外的安全性來保護您的文件。

將 JPG 合併為 JPG - 開發人員指南

您還可以使用我們的獨立庫或云 API 以編程方式合併 JPG 圖像。以下部分將簡要概述如何執行此操作。

在 C# 中合併 JPG 圖像

下面是在C#中合併JPG圖片的步驟。

// Create a list of images
string[] imagePaths = { "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.png" };

// Get resulting image's size
List<Size> imageSizes = new List<Size>();
foreach (string imagePath in imagePaths)
{
    using (RasterImage image = (RasterImage)Image.Load(imagePath))
    {
        imageSizes.Add(image.Size);
    }
}

int newWidth = imageSizes.Max(size => size.Width);
int newHeight = imageSizes.Sum(size => size.Height);

// Combine images into new one
using (MemoryStream memoryStream = new MemoryStream())
{
    // Create output source
    StreamSource outputStreamSource = new StreamSource(memoryStream);
    
    // Create jpeg options
    JpegOptions options = new JpegOptions() { Source = outputStreamSource, Quality = 100 };
    
    // Create output image
    using (JpegImage newImage = (JpegImage)Image.Create(options, newWidth, newHeight))
    {
        int stitchedHeight = 0;
        // Merge images
        foreach (string imagePath in imagePaths)
        {
            using (RasterImage image = (RasterImage)Image.Load(imagePath))
            {
                Rectangle bounds = new Rectangle(0, stitchedHeight, image.Width, image.Height);
                newImage.SaveArgb32Pixels(bounds, image.LoadArgb32Pixels(image.Bounds));
                stitchedHeight += image.Height;
            }
        }
        
        // Save the merged image
        newImage.Save("merged-image.jpg");
    }
}

閱讀有關 如何在 C# 中合併 JPG 圖像 的詳細教程。

在 Java 中合併 JPG 圖像

以下是面向 Java 開發人員的步驟和代碼示例。

// List of images
String[] imagePaths = { "image.jpg", "image.jpg" };

// Output image path
String outputPath = "output-horizontal.jpg";
String tempFilePath = "temp.jpg";

// Get resulting image size
int newWidth = 0;
int newHeight = 0;
for (String imagePath : imagePaths) {
    try (RasterImage image = (com.aspose.imaging.RasterImage) com.aspose.imaging.Image.load(imagePath)) {
        Size size = image.getSize();
        newWidth += size.getWidth();
        newHeight = Math.max(newHeight, size.getHeight());
    }
}

// Combine images into new one
try (JpegOptions options = new JpegOptions()) {
    Source tempFileSource = new FileCreateSource(tempFilePath, true);
    options.setSource(tempFileSource);
    options.setQuality(100);

    // Create resultant image
    try (JpegImage newImage = (JpegImage) Image.create(options, newWidth, newHeight)) {
        int stitchedWidth = 0;
       for (String imagePath : imagePaths) {
            try (RasterImage image = (RasterImage) Image.load(imagePath)) {
                Rectangle bounds = new Rectangle(stitchedWidth, 0, image.getWidth(), image.getHeight());
                newImage.saveArgb32Pixels(bounds, image.loadArgb32Pixels(image.getBounds()));
                stitchedWidth += image.getWidth();
            }
        }
    
            // Save output image
        newImage.save(outputPath);
    }
}

閱讀有關 在 Java 中合併 JPG 圖像 的完整指南。

探索雲 API

您還可以探索我們的基於雲的圖像處理 API 來合併圖像。

常見問題

如何在線將 JPG 合併為 JPG?

我們提供了合併 JPG 圖像的最簡單方法。上傳 JPG 文件,選擇模式,選擇輸出格式,然後啟動合併過程。合併後,輸出文件將可供下載。

將 JPG 合併為 JPG 需要多長時間?

我們的在線 JPG 合併速度驚人,可在幾秒鐘內合併 JPG 圖像。

如何創建 JPG 合併工具?

您可以使用我們的獨立庫Cloud API 來完成。

這個 JPG 合併工具是否依賴於瀏覽器?

不,您可以使用任何現代瀏覽器,例如 Chrome、Edge、Firefox 等。

也可以看看