This project has moved and is read-only. For the latest updates, please go here.

how to set image opacity by percentage?

Jan 11, 2014 at 5:25 AM
Will this work or is there a cleaner way to do this?
MagickImage pattern = new MagickImage("image.png");
pattern.Alpha(AlphaOption.Set);
var Divisor = Quantum.Max / (Quantum.Max * PercentageF)
pattern.QuantumOperator(Channels.Alpha, EvaluateOperator.Set, Quantum.Max / Divisor);
Jan 11, 2014 at 8:46 AM
Edited Jan 11, 2014 at 11:27 AM
That is the cleanest way to do this. The QuantumOperator method is the method you need when you want to do some quick and simple pixel operations.