本文整理汇总了C#中ImageMagick.MagickImage.Strip方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Strip方法的具体用法?C# MagickImage.Strip怎么用?C# MagickImage.Strip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.Strip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
private static void Process(int width, int height, MagickImage image, int? quality)
{
image.Strip();
if (quality.HasValue)
{
image.Quality = quality.Value;
}
//模版的宽高比例
var templateRate = (double)width / height;
//原图片的宽高比例
var nowRate = (double)image.Width / image.Height;
if (templateRate < nowRate)
{
//以高为准缩放
// Resize each image in the collection to a width of 200. When zero is specified for the height
// the height will be calculated with the aspect ratio.
image.Resize(0, height);
image.ChopHorizontal(width, image.Width - width);
}
else
{
//以宽为准缩放
image.Resize(width, 0);
image.ChopVertical(height, image.Height - height);
}
}
示例2: Test_ClippingPaths
public void Test_ClippingPaths()
{
using (MagickImage image = new MagickImage(Files.EightBimTIF))
{
EightBimProfile profile = image.Get8BimProfile();
TestProfile(profile);
using (MagickImage emptyImage = new MagickImage(Files.EightBimTIF))
{
emptyImage.Strip();
Assert.IsNull(emptyImage.GetIptcProfile());
emptyImage.AddProfile(profile);
profile = emptyImage.Get8BimProfile();
TestProfile(profile);
}
}
}
示例3: buttonRun_Click
private void buttonRun_Click(object sender, EventArgs e)
{
double savings;
string outputName;
FileInfo before;
FileInfo after;
MagickImage mi;
foreach (ListViewItem listedImage in listViewMain.Items)
{
// File size before shrinking
before = new FileInfo(listedImage.Text);
mi = new MagickImage(listedImage.Text);
// Get the output file path
if (Properties.Settings.Default.overwrite)
{
outputName = listedImage.Text;
}
else if (Directory.Exists(Properties.Settings.Default.path)) {
outputName = Properties.Settings.Default.path + "\\" + before.Name;
}
else
{
MessageBox.Show("Invalid output directory", "Error");
break;
}
// Remove picture metadata
if (Properties.Settings.Default.strip)
{
mi.Strip();
}
// Resize to max dimensions
if (Properties.Settings.Default.resize)
{
if (Properties.Settings.Default.units == 0)
{
mi.Resize(
Properties.Settings.Default.maxWidth,
Properties.Settings.Default.maxHeight
);
}
else if (Properties.Settings.Default.units == 1)
{
mi.Resize(
new Percentage(Properties.Settings.Default.maxWidth),
new Percentage(Properties.Settings.Default.maxHeight)
);
}
}
mi.Quality = Properties.Settings.Default.quality * (100 / 13);
mi.Interlace = Interlace.Jpeg;
try
{
mi.Write(outputName);
}
catch (MagickBlobErrorException ex)
{
MessageBox.Show("Unable to write file to specified path.\n" + ex.Message, "Error");
break;
}
// File size after shrinking;
after = new FileInfo(outputName);
// Calculate and display the savings
savings = 1 - (double)after.Length / before.Length;
listedImage.SubItems[columnSavings.Index].Text = savings.ToString("p1");
}
}
示例4: ExecuteStrip
private static void ExecuteStrip(MagickImage image)
{
image.Strip();
}