免费在线将 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 等。

也可以看看