sample code for the Wiki
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- csharp
調査の方向性
この issue には、Magick.NET 用の C# サンプルが 2 つあります。基本的な画像プロパティと、セピア変換およびグレースケール変換を伴うカラープロファイルの処理です。まず適切な Wiki の場所を特定し、現在のサンプルの規約を確認してください。サンプルが明確で使いやすい形でそこに組み込まれれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Prerequisites
- I have written a descriptive issue title
- I have verified that I am using the latest version of Magick.NET
System Configuration
- Magick.NET version:
- Environment (Operating system: Windows
Samples
Sample 1 -- List basic properties of input file (file = path of image).
MagickReadSettings settings = new MagickReadSettings();
settings.Verbose = true;
settings.Debug = true;
using (MagickImage image = new MagickImage(file, settings))
{
// Attach event handler to warning event
image.Warning += MagickImage_Warning;
Console.WriteLine("MagicKImage" + image.Format.ToString() + ", " + image.BaseWidth + ", " + image.BaseHeight +
", Depth: " + image.Depth + ", Channels: " + image.ChannelCount +
", ColorSpace:" + image.ColorSpace.ToString());
Console.WriteLine("MimeType: " + image.FormatInfo.MimeType +
", Type: " + image.GetType().ToString() +
", MultiFramed: " + image.FormatInfo.IsMultiFrame.ToString() +
", HasAlpha: " + image.HasAlpha.ToString());
Console.WriteLine("Comment:" + image.Comment);
}
Sample 2 - Color profile handling and conversion sample (sepia and grayscale).
/// ImageMagick.GetNextImageProperty(image);
using (MagickImage image = new MagickImage(file, settings))
{
/// ============================ COLOR PRofile testing
///
ColorProfile icc = image.GetColorProfile();
ImageMagick.ColorProfile profile = null;
String dest = null;
image.Comment = "mark test";
String CMYKProfilePath = "e:\Images\jpg\Test CMYK Profile.icc";
String GRAYProfilePath = "e:\Images\jpg\Test GRAY Profile.icc";
String RGBProfilePath = "e:\Images\jpg\Test RGB Profile.icc";
String baseName = Path.GetFileNameWithoutExtension(file);
String basePath = Path.GetFullPath(file);
Console.WriteLine("\nColor profile: {0}, colorSpace {1}", icc.Name, icc.ColorSpace);
ImageMagick.ColorSpace sourceImageColorSpace = image.ColorSpace;
//Check if image color space is of type CMYK, add color profile accordingly
if (sourceImageColorSpace == ImageMagick.ColorSpace.CMYK)
{
//Adding of other color profiles code commented till the time the issue of multiple profile addition resolved
//_profilesCMYK is the list containing the ICSProfiles
if (CMYKProfilePath != "")
{ //Create a new color profile object according to selection and add it into image
IMagickImage clone = image.Clone();
clone.TransformColorSpace(ColorProfile.AdobeRGB1998); // input must have a color profile
// used file saved on disk...
profile = new ImageMagick.ColorProfile(CMYKProfilePath);
image.AddProfile(profile, true); // true = replace profile with selected one (ie. path)
image.TransformColorSpace(ColorProfile.AdobeRGB1998);
image.Format = MagickFormat.Jpeg;
// Save the result
dest = "e:\\images\\jpg\\"+baseName +"-cmykToRGB.jpg";
image.Write(dest);
dest = "e:\\images\\jpg\\" + baseName + "-cmykToRGBusingInput.jpg";
clone.TransformColorSpace(ColorProfile.AdobeRGB1998); // convert to RGB applying input profile
clone.Write(dest);
// test converting to Gray scale..
IMagickImage Sepia = image.Clone();
Sepia.SepiaTone();
dest = "e:\\images\\jpg\\" + baseName + "-cmykToSepia.jpg";
Sepia.Write(dest);
// test converting to Gray scale..
IMagickImage grey = image.Clone();
grey.Grayscale();
dest = "e:\\images\\jpg\\" + baseName + "-cmykToGray.jpg";
grey.Write(dest);
grey.Format = MagickFormat.Png;
dest = "e:\\images\\jpg\\" + baseName + "-cmykToGray.png";
grey.Write(dest);
grey.Format = MagickFormat.Tiff;
dest = "e:\\images\\jpg\\" + baseName + "-cmykToGray.tiff";
grey.Write(dest);
// Test stripping all profiles
dest = "e:\\images\\jpg\\" + baseName + "-cmykToRGBNoProfiles.jpg";
image.Strip();
image.Write(dest);
continue;
}//End if
}
//Check if image color space is of type RGB, add color profile accordingly
else if (sourceImageColorSpace == ImageMagick.ColorSpace.RGB ||
sourceImageColorSpace == ImageMagick.ColorSpace.sRGB)
{
image.Format = MagickFormat.Jpeg;
image.BorderColor = MagickColor.FromRgb(255, 0, 0);
image.Border(5);
// Save the result
dest = "e:\\images\\jpg\\" + baseName + "-isRGB.jpg";
image.TransformColorSpace(ColorProfile.AdobeRGB1998); // Convert to RGB using input Profile.
image.Write(dest);
dest = "e:\\images\\jpg\\" + baseName + "-isRGBSepia.jpg";
image.SepiaTone();
image.Write(dest);
//ICSPrfile is the object containing the name and path of availabe prfiles
//_profilesRGB is the list containing the ICSProfiles
if (RGBProfilePath != "")
{ //Create a new color profile object according to selection and add it into image
// profile = new ImageMagick.ColorProfile(RGBProfilePath);
// image.AddProfile(profile, true); // Overwrite Existing.
}//End if
continue;
}
//Check if image color space is of type GRAY, add color profile accordingly
else if (sourceImageColorSpace == ImageMagick.ColorSpace.Gray)
{
if (GRAYProfilePath != "")
{ //Create a new color profile object according to selection and add it into image
profile = new ImageMagick.ColorProfile(GRAYProfilePath);
image.AddProfile(profile, true); // Replace input profile (not applying input)
image.TransformColorSpace(ColorProfile.AdobeRGB1998); // convert to RGB.
image.Format = MagickFormat.Jpeg;
// Save the result
dest = "e:\\images\\jpg\\GrayToRGB.jpg";
image.Write(dest);
continue;
}//End if
}
}
- 主要言語
- C#
- スター
- 4k
- フォーク
- 454
- 平均マージ
- 12時間 54分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dlemstra/Magick.NET のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dlemstra/Magick.NET#2087 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
dlemstra/Magick.NET#2100 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
dlemstra/Magick.NET#2098 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
dlemstra/Magick.NET#2042 · コメント 4 件 ·
-
GPU supportオープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
dlemstra/Magick.NET#1949 · コメント 5 件 ·
dlemstra/Magick.NET の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
sebastienros/jint#4282 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
pyrevitlabs/pyRevit#3792 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
fboucher/2d6-dungeon-app#256 ·
メンテナーはふだん 1 日以内に返信
-
area: design documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
eyalgolan/statecraft-israel#883 ·
メンテナーはふだん 1 日以内に返信