C# 将图像从python转换为c-图像大小差别太大

C# 将图像从python转换为c-图像大小差别太大,c#,.net,python,bitmap,C#,.net,Python,Bitmap,我正在尝试将图像从python转换为c,python创建的图像的大小要小得多,而.net创建的图像的大小要大得多。我不想降低图像的质量,也不知道为什么会这样 下面是python代码 if img.mode != "RGB": img = img.convert("RGB") img = img.resize((width,height), Image.ANTIALIAS) resampled_image_name = os.pat

我正在尝试将图像从python转换为c,python创建的图像的大小要小得多,而.net创建的图像的大小要大得多。我不想降低图像的质量,也不知道为什么会这样

下面是python代码

        if img.mode != "RGB":
        img = img.convert("RGB")
        img = img.resize((width,height), Image.ANTIALIAS)

        resampled_image_name = os.path.splitext(resampled_image_name)[0] + "." + format
        img.save(resampled_image_name)
这是我的c代码

        Bitmap bitmap = new Bitmap(width, height);

        using (Graphics gr = Graphics.FromImage(bitmap))
        {
            gr.DrawImage(srcImage, new Rectangle(0, 0, width, height));
        }

        FileInfo info = new FileInfo(resampledImageName);
        resampledImageName = resampledImageName.Replace(info.Extension, "." + format);

        bitmap.Save(@resampledImageName);

它的图像队列有不同的格式,但大多数是jpg和GIF。如果你说大小,你是指文件大小吗?如果是:您在python和c中以相同的格式存储它们吗?是的,文件大小,是的,它们以相同的格式存储,这可能是因为python中的RGB模式,我不知道是否可以在CY中配置,您在c版本中没有显示保存代码。请出示密码。除非您指定保存格式,否则“位图.保存”会将其保存为BMP格式。我已使用“保存”方法更新了代码,但供您评论。我提供的文件格式。