现有一JPG格式图片,右击,选择“编辑”,打开画图工具,然后“另存为”,同样是JPG格式,大小改变了?
  我试的是从3M多,转换为 1M左右,这里称之为“不变格式压缩”  如果我要实现批量JPG文件的“不变格式压缩”,怎么实现,压缩后的格式可以不限制,只要失真不严重就行??  哪位高手可以解决这问题??
  

解决方案 »

  1.   

    photoshop应该可以实现批量转换,下载个试试
      

  2.   

    找到一个小软件,感觉还可以,基本解决了问题。
    软件名:Imagicon
      

  3.   

    imagemagik 写一段bat文件就可以了
      

  4.   

    #include <windows.h>
    #include <gdiplus.h>
    #include <stdio.h>
    using namespace Gdiplus;INT GetEncoderClsid(const WCHAR* format, CLSID* pClsid);  // helper functionINT main()
    {
       // Initialize GDI+.
       GdiplusStartupInput gdiplusStartupInput;
       ULONG_PTR gdiplusToken;
       GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);   CLSID             encoderClsid;
       EncoderParameters encoderParameters;
       ULONG             quality;
       Status            stat;   // Get an image from the disk.
       Image* image = new Image(L"Shapes.bmp");   // Get the CLSID of the JPEG encoder.
       GetEncoderClsid(L"image/jpeg", &encoderClsid);   // Before we call Image::Save, we must initialize an
       // EncoderParameters object. The EncoderParameters object
       // has an array of EncoderParameter objects. In this
       // case, there is only one EncoderParameter object in the array.
       // The one EncoderParameter object has an array of values.
       // In this case, there is only one value (of type ULONG)
       // in the array. We will let this value vary from 0 to 100.   encoderParameters.Count = 1;
       encoderParameters.Parameter[0].Guid = EncoderQuality;
       encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;
       encoderParameters.Parameter[0].NumberOfValues = 1;   // Save the image as a JPEG with quality level 0.
       quality = 0;
       encoderParameters.Parameter[0].Value = &quality;
       stat = image->Save(L"Shapes001.jpg", &encoderClsid, &encoderParameters);   if(stat == Ok)
          wprintf(L"%s saved successfully.\n", L"Shapes001.jpg");
       else
          wprintf(L"%d  Attempt to save %s failed.\n", stat, L"Shapes001.jpg");   // Save the image as a JPEG with quality level 50.
       quality = 50;
       encoderParameters.Parameter[0].Value = &quality;
       stat = image->Save(L"Shapes050.jpg", &encoderClsid, &encoderParameters);   if(stat == Ok)
          wprintf(L"%s saved successfully.\n", L"Shapes050.jpg");
       else
          wprintf(L"%d  Attempt to save %s failed.\n", stat, L"Shapes050.jpg");      // Save the image as a JPEG with quality level 100.
       quality = 100;
       encoderParameters.Parameter[0].Value = &quality;
       stat = image->Save(L"Shapes100.jpg", &encoderClsid, &encoderParameters);   if(stat == Ok)
          wprintf(L"%s saved successfully.\n", L"Shapes100.jpg");
       else
          wprintf(L"%d  Attempt to save %s failed.\n", stat, L"Shapes100.jpg");   delete image;
       GdiplusShutdown(gdiplusToken);
       return 0;
    }
    用vs2003或者vs2005里面的gdi+库,应该很容易的吧。如果你懒得装那么大的,有个轻量级的编译器:
    http://download255.mediafire.com/loljmombrmjg/zlnecmbmzvm/Visual+C%2B%2B+6.0%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%E5%8A%A0%E5%BC%BA%E7%89%88.rar