Compress JPEG in Visual Studio with

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Posts: 1
Joined: 2019-07-11T00:42:21-07:00
Authentication code: 1152

Compress JPEG in Visual Studio with

Post by jw-ucm »

I need code which which allow me to compress JPEG Images which are approximately 3,000 KB in file size to around 400-800KB using Magick.Net on Visual Studio.

Thus far I have tried the following below however this doesn't compress the image into a small enough file size which i require.

Code: Select all

FileInfo info = new FileInfo("c:\\testimage.jpg");
ImageOptimizer optimizer = new ImageOptimizer();
Console.WriteLine("Bytes before: " + info.Length);
Console.WriteLine("Bytes after: " + info.Length); 

As detailed before, my intentions are to achieve compression to around 400-800 KB for each image, which will then allow to complete the next task.
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Compress JPEG in Visual Studio with

Post by snibgo »

Sorry, I don't know But you don't seem to use a "-quality" setting.

I suggest you experiment at the command line, eg:

Code: Select all

magick testimage.jpg -quality 10 out.jpg
Compressing a JPEG to around 20% of its size is aggressive. A sufficiently low quality number will probably do it, but the quality may be unacceptable.
snibgo's IM pages:
Post Reply