Skip to content

How can I decrease image size as low as possible with resize? #1521

Answered by JimBobSquarePants
martonx asked this question in Q&A
Discussion options

You must be logged in to vote

It's got a massive ICC profile embedded in it.

Using the following code to resize and strip the profile.

using (var image = Image.Load(Path.Combine(inPath, "discussions.jpg")))
{
    var options = new ResizeOptions { Mode = ResizeMode.Max, Size = new Size(55, 55) };
    image.Mutate(x => x.Resize(options));
    image.Metadata.IccProfile = null;
    image.Save(Path.Combine(outPath, "discussions-no-meta.jpg"));
}

A jpeg of 55x41px is 3.07kb

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@martonx
Comment options

@JimBobSquarePants
Comment options

Answer selected by JimBobSquarePants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants