├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature-request.md │ └── bug-report.md ├── PULL_REQUEST_TEMPLATE.md └── CONTRIBUTING.md ├── .gitattributes ├── src ├── Magick.Native │ ├── Magick.Native.version │ ├── build │ │ ├── Debug-Q8-x64.cmd │ │ ├── Debug-Q8-x86.cmd │ │ ├── Debug-Q16-x64.cmd │ │ ├── Debug-Q16-x86.cmd │ │ ├── Debug-Q16-HDRI-x64.cmd │ │ └── Debug-Q16-HDRI-x86.cmd │ ├── install.cmd │ ├── TrademarkAttribute.cs │ ├── nuget.config │ ├── libraries.md │ └── install.sh ├── Magick.NET │ ├── Framework │ │ ├── GlobalSuppressions.cs │ │ ├── Extensions │ │ │ └── StreamExtensions.cs │ │ ├── BitmapDensity.cs │ │ ├── Helpers │ │ │ ├── FileHelper.cs │ │ │ └── XmlHelper.cs │ │ └── Colors │ │ │ └── ColorRGB.cs │ ├── Resources │ │ └── ColorProfiles │ │ │ ├── RGB │ │ │ ├── SRGB.icm │ │ │ ├── AppleRGB.icc │ │ │ ├── AdobeRGB1998.icc │ │ │ └── ColorMatchRGB.icc │ │ │ └── CMYK │ │ │ ├── CoatedFOGRA39.icc │ │ │ └── USWebCoatedSWOP.icc │ ├── Native │ │ ├── Helpers │ │ │ ├── MagickMemory.json │ │ │ └── Environment.json │ │ ├── Types │ │ │ ├── PrimaryInfo.json │ │ │ ├── PointInfo.json │ │ │ ├── StringInfo.json │ │ │ ├── MagickRectangle.json │ │ │ ├── OffsetInfo.json │ │ │ ├── MagickGeometry.json │ │ │ ├── TypeMetric.json │ │ │ └── PointInfoCollection.json │ │ ├── Matricis │ │ │ └── DoubleMatrix.json │ │ ├── Quantum.json │ │ ├── Statistics │ │ │ ├── ChannelPerceptualHash.json │ │ │ ├── Moments.json │ │ │ ├── Statistics.json │ │ │ ├── PerceptualHash.json │ │ │ └── ChannelMoments.json │ │ ├── OpenCL │ │ │ ├── OpenCLKernelProfileRecord.json │ │ │ └── OpenCL.json │ │ ├── Colors │ │ │ ├── MagickColorCollection.json │ │ │ └── MagickColor.json │ │ ├── ResourceLimits.json │ │ ├── Settings │ │ │ └── QuantizeSettings.json │ │ └── INativeInstance.cs │ ├── Shared │ │ ├── Defines │ │ │ ├── IReadDefines.cs │ │ │ ├── IWriteDefines.cs │ │ │ ├── IDefines.cs │ │ │ ├── IDefine.cs │ │ │ └── ReadDefinesCreator.cs │ │ ├── Helpers │ │ │ ├── ValidatedNotNullAttribute.cs │ │ │ ├── MagickMemory.cs │ │ │ └── FileHelper.cs │ │ ├── Profiles │ │ │ ├── Exif │ │ │ │ ├── Tags │ │ │ │ │ ├── UnkownExifTag.cs │ │ │ │ │ ├── ExifTag.SignedRationalArray.cs │ │ │ │ │ └── ExifTag{TValueType}.cs │ │ │ │ └── Values │ │ │ │ │ ├── ExifFloatArray.cs │ │ │ │ │ ├── ExifSignedByteArray.cs │ │ │ │ │ ├── ExifSignedLongArray.cs │ │ │ │ │ ├── ExifSignedShortArray.cs │ │ │ │ │ ├── ExifLongArray.cs │ │ │ │ │ ├── IExifValue{TValueType}.cs │ │ │ │ │ ├── ExifShortArray.cs │ │ │ │ │ ├── ExifDoubleArray.cs │ │ │ │ │ ├── ExifByteArray.cs │ │ │ │ │ ├── ExifRationalArray.cs │ │ │ │ │ ├── ExifSignedLong.cs │ │ │ │ │ ├── ExifSignedRationalArray.cs │ │ │ │ │ └── ExifRational.cs │ │ │ ├── 8Bim │ │ │ │ ├── IClipPath.cs │ │ │ │ └── IEightBimProfile.cs │ │ │ └── IImageProfile.cs │ │ ├── Extensions │ │ │ ├── ExtensionAttribute.cs │ │ │ └── INativeInstanceExtensions.cs │ │ ├── Drawables │ │ │ ├── Coordinates │ │ │ │ └── PathArcCoordinates.cs │ │ │ ├── Paths │ │ │ │ └── IPath.cs │ │ │ ├── IDrawable.cs │ │ │ └── IDrawingWand.cs │ │ ├── EventArgs │ │ │ └── ArtifactEventArgs.cs │ │ ├── Formats │ │ │ ├── Dds │ │ │ │ └── DdsCompression.cs │ │ │ ├── Jpeg │ │ │ │ └── JpegDctMethod.cs │ │ │ ├── Tiff │ │ │ │ └── TiffAlpha.cs │ │ │ ├── Psd │ │ │ │ └── PsdAdditionalInfoPart.cs │ │ │ └── Bmp │ │ │ │ └── BmpSubtype.cs │ │ ├── Enums │ │ │ ├── Endian.cs │ │ │ ├── FillRule.cs │ │ │ ├── ClassType.cs │ │ │ ├── OpenCLDeviceType.cs │ │ │ ├── LayerMethod.cs │ │ │ ├── TextDirection.cs │ │ │ ├── DensityUnit.cs │ │ │ ├── LineCap.cs │ │ │ ├── LineJoin.cs │ │ │ ├── DitherMethod.cs │ │ │ ├── TextAlignment.cs │ │ │ ├── GifDisposeMethod.cs │ │ │ └── AutoThresholdMethod.cs │ │ ├── Configuration │ │ │ └── IConfigurationFile.cs │ │ ├── Types │ │ │ ├── PointInfo.cs │ │ │ ├── OffsetInfo.cs │ │ │ └── StringInfo.cs │ │ └── Exceptions │ │ │ ├── Error │ │ │ └── MagickErrorException.cs │ │ │ └── Warning │ │ │ └── MagickWarningException.cs │ ├── Core │ │ ├── AnyCPU │ │ │ └── NativeLibraryLoader.cs │ │ ├── Attributes │ │ │ ├── NonSerializedAttribute.cs │ │ │ └── SerializableAttribute.cs │ │ ├── Helpers │ │ │ ├── FileHelper.cs │ │ │ └── XmlHelper.cs │ │ ├── Script │ │ │ └── MagickScript.cs │ │ └── Extensions │ │ │ └── MemoryStreamExtensions.cs │ └── Properties │ │ ├── AssemblyInfo.cs │ │ └── InternalsVisibleTo.cs └── Magick.NET.ruleset ├── tests ├── Magick.NET.Tests │ ├── Framework │ │ ├── Script │ │ │ └── Invalid.msl │ │ └── Colors │ │ │ └── ColorRGBTests │ │ │ └── TheConstructor.cs │ ├── Images │ │ ├── ImageMagick.txt │ │ ├── Red.png │ │ ├── 8Bim.tif │ │ ├── CMYK.jpg │ │ ├── Circle.png │ │ ├── Letter.jpg │ │ ├── Noise.png │ │ ├── Test.png │ │ ├── wand.ico │ │ ├── white.jpg │ │ ├── Corrupt.png │ │ ├── Picture.jpg │ │ ├── viceland.png │ │ ├── Coders │ │ │ ├── Page.tif │ │ │ ├── Test.dds │ │ │ ├── Test.mng │ │ │ ├── grim.jp2 │ │ │ ├── Player.psd │ │ │ ├── wizard.psd │ │ │ ├── IgnoreTag.tif │ │ │ ├── SwedenHeart.eps │ │ │ ├── CN Studios Logo.ai │ │ │ ├── RowsPerStrip.tif │ │ │ ├── layer-styles-sample.psd │ │ │ ├── pdf-example-password.original.pdf │ │ │ └── Animated_PNG_example_bouncing_beach_ball.png │ │ ├── ImageMagick.ico │ │ ├── ImageMagick.jpg │ │ ├── Invitation.tif │ │ ├── RöseSparkle.gif │ │ ├── Snakeware.png │ │ ├── wireframe.tif │ │ ├── ExifUndefType.jpg │ │ ├── Magick.NET.icon.png │ │ ├── ConnectedComponents.png │ │ ├── FujiFilmFinePixS1Pro.gif │ │ ├── FujiFilmFinePixS1Pro.jpg │ │ └── FujiFilmFinePixS1Pro.png │ ├── Fonts │ │ ├── cour.ttf │ │ ├── arial.ttf │ │ └── KaushanScript-Regular.ttf │ ├── Properties │ │ └── launchSettings.json │ ├── Shared │ │ ├── Script │ │ │ ├── ImageProfile.msl │ │ │ ├── Defines.msl │ │ │ ├── Events.msl │ │ │ ├── Resize.msl │ │ │ ├── Variables.msl │ │ │ ├── PixelReadSettings.msl │ │ │ ├── Collection.msl │ │ │ ├── Distort.msl │ │ │ └── Draw.msl │ │ ├── Optimizers │ │ │ ├── GifOptimizerTests │ │ │ │ ├── Init.cs │ │ │ │ └── TheOptimalCompressionProperty.cs │ │ │ ├── IcoOptimizerTests │ │ │ │ ├── Init.cs │ │ │ │ └── TheOptimalCompressionProperty.cs │ │ │ ├── JpegOptimizerTests │ │ │ │ ├── Init.cs │ │ │ │ └── TheOptimalCompressionProperty.cs │ │ │ ├── PngOptimizerTests │ │ │ │ ├── Init.cs │ │ │ │ └── TheOptimalCompressionProperty.cs │ │ │ └── ImageOptimizerTests │ │ │ │ └── Init.cs │ │ ├── ResourceLimitsTests │ │ │ └── Init.cs │ │ ├── Profiles │ │ │ └── Exif │ │ │ │ └── ExifProfileTests │ │ │ │ └── Init.cs │ │ ├── Helpers │ │ │ ├── ByteConverterTests.cs │ │ │ └── ShortConverterTests.cs │ │ ├── Drawables │ │ │ └── DrawablePathTests.cs │ │ ├── Extensions │ │ │ └── INativeInstanceExtensionsTests.cs │ │ ├── Formats │ │ │ └── Tiff │ │ │ │ └── TiffWriteDefinesTests │ │ │ │ └── Init.cs │ │ ├── QuantumTests │ │ │ └── TheDepthProperty.cs │ │ └── Settings │ │ │ └── MagickSettingsTests │ │ │ └── TheVerboseProperty.cs │ ├── TestIssue.cs │ ├── Helpers │ │ ├── ExcludeFromCodeCoverageAttribute.cs │ │ ├── NonSeekableStream.cs │ │ ├── SeekExceptionStream.cs │ │ ├── ReadExceptionStream.cs │ │ ├── WriteExceptionStream.cs │ │ ├── TellExceptionStream.cs │ │ └── TestImageProfile.cs │ └── Windows │ │ └── OpenCL │ │ └── OpenCLTests.cs └── Magick.NET.ruleset ├── samples └── Magick.NET.Samples │ ├── Files │ ├── InvalidFile.jpg │ ├── Snakeware.gif │ ├── Snakeware.jpg │ ├── Snakeware.pdf │ ├── Snakeware.png │ ├── StillLife.cr2 │ ├── CorruptImage.jpg │ ├── YourProfile.icc │ ├── 2FD-Background.jpg │ ├── FileWithWarning.jpg │ └── FujiFilmFinePixS1Pro.jpg │ ├── Output │ └── Readme.txt │ ├── Scripts │ ├── Wave.msl │ ├── Crop.msl │ ├── Resize.msl │ └── Clone.msl │ ├── Magick.NET.Samples.csproj │ └── Program.cs ├── Magick.NET.snk ├── publish ├── update.version.cmd ├── publish.cmd ├── push.cmd ├── Magick.NET.targets └── set.version.ps1 ├── logo └── Magick.NET.icon.png ├── docs ├── img │ └── example_addTextToExistingImage.jpg ├── LosslessCompression.md ├── Versioning.md ├── ReadRawImageFromCamera.md ├── DetailedDebugInformation.md ├── Watermark.md ├── Defines.md ├── UsingColors.md ├── ExceptionHandling.md └── ExifData.md ├── tools ├── Generate.Drawables.cmd ├── Generate.MagickScript.cmd ├── Generate.Native.cmd ├── Generate.MagickColors.cmd ├── FileGenerators │ ├── MagickScript │ │ ├── App.config │ │ ├── Program.cs │ │ └── Code │ │ │ └── Settings │ │ │ ├── DeskewSettingsGenerator.cs │ │ │ ├── KmeansSettingsGenerator.cs │ │ │ ├── ComplexSettingsGenerator.cs │ │ │ ├── DistortSettingsGenerator.cs │ │ │ ├── MontageSettingsGenerator.cs │ │ │ ├── PixelReadSettingsGenerator.cs │ │ │ ├── QuantizeSettingsGenerator.cs │ │ │ └── MorphologySettingsGenerator.cs │ ├── Native │ │ ├── App.config │ │ ├── Program.cs │ │ ├── Data │ │ │ └── DynamicMode.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── Drawables │ │ ├── App.config │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── AppDomain │ │ │ └── DrawableApplicationProxy.cs │ ├── MagickColors │ │ ├── App.config │ │ └── Program.cs │ └── Shared │ │ ├── QuantumDepth.cs │ │ ├── PathHelper.cs │ │ ├── AppDomain │ │ └── ApplicationProxy.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── Extensions │ │ └── IEnumerableExtensions.cs └── windows │ └── FileGenerator.Drawables.ps1 ├── .dockerignore ├── .gitignore └── stylecop.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: dlemstra -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | *.pl eol=lf 3 | -------------------------------------------------------------------------------- /src/Magick.Native/Magick.Native.version: -------------------------------------------------------------------------------- 1 | 2020.5.17.844 -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Framework/Script/Invalid.msl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/InvalidFile.jpg: -------------------------------------------------------------------------------- 1 | ThisIsNotAJPEG 2 | -------------------------------------------------------------------------------- /src/Magick.Native/build/Debug-Q8-x64.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "Build.cmd" Debug Q8 x64 -------------------------------------------------------------------------------- /src/Magick.Native/build/Debug-Q8-x86.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "Build.cmd" Debug Q8 x86 -------------------------------------------------------------------------------- /Magick.NET.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/Magick.NET.snk -------------------------------------------------------------------------------- /src/Magick.Native/build/Debug-Q16-x64.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "Build.cmd" Debug Q16 x64 -------------------------------------------------------------------------------- /src/Magick.Native/build/Debug-Q16-x86.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "Build.cmd" Debug Q16 x86 -------------------------------------------------------------------------------- /src/Magick.Native/build/Debug-Q16-HDRI-x64.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "Build.cmd" Debug Q16-HDRI x64 -------------------------------------------------------------------------------- /src/Magick.Native/build/Debug-Q16-HDRI-x86.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "Build.cmd" Debug Q16-HDRI x86 -------------------------------------------------------------------------------- /publish/update.version.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | powershell .\update.version.ps1 -version "7.17.0.1" 4 | -------------------------------------------------------------------------------- /logo/Magick.NET.icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/logo/Magick.NET.icon.png -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Output/Readme.txt: -------------------------------------------------------------------------------- 1 | This folder contains the images that are created by some of the samples. -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/ImageMagick.txt: -------------------------------------------------------------------------------- 1 | I 2 | m 3 | a 4 | g 5 | e 6 | M 7 | a 8 | g 9 | i 10 | c 11 | k -------------------------------------------------------------------------------- /src/Magick.Native/install.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | powershell .\install.ps1 4 | if %errorlevel% neq 0 exit /b %errorlevel% -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Fonts/cour.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Fonts/cour.ttf -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Red.png -------------------------------------------------------------------------------- /src/Magick.Native/TrademarkAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | [assembly: System.Reflection.AssemblyTrademark("ImageMagick 7.0.10.13")] -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Fonts/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Fonts/arial.ttf -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/8Bim.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/8Bim.tif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/CMYK.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/CMYK.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Circle.png -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Letter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Letter.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Noise.png -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Test.png -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/wand.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/wand.ico -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/white.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/white.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Corrupt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Corrupt.png -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Picture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Picture.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/viceland.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/viceland.png -------------------------------------------------------------------------------- /docs/img/example_addTextToExistingImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/docs/img/example_addTextToExistingImage.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/Page.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/Page.tif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/Test.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/Test.dds -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/Test.mng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/Test.mng -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/grim.jp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/grim.jp2 -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/ImageMagick.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/ImageMagick.ico -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/ImageMagick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/ImageMagick.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Invitation.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Invitation.tif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/RöseSparkle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/RöseSparkle.gif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Snakeware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Snakeware.png -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/wireframe.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/wireframe.tif -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/Snakeware.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/Snakeware.gif -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/Snakeware.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/Snakeware.jpg -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/Snakeware.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/Snakeware.pdf -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/Snakeware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/Snakeware.png -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/StillLife.cr2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/StillLife.cr2 -------------------------------------------------------------------------------- /src/Magick.NET/Framework/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Framework/GlobalSuppressions.cs -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/Player.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/Player.psd -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/wizard.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/wizard.psd -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/ExifUndefType.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/ExifUndefType.jpg -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/CorruptImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/CorruptImage.jpg -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/YourProfile.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/YourProfile.icc -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/IgnoreTag.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/IgnoreTag.tif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Magick.NET.icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Magick.NET.icon.png -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/2FD-Background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/2FD-Background.jpg -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/FileWithWarning.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/FileWithWarning.jpg -------------------------------------------------------------------------------- /src/Magick.NET/Resources/ColorProfiles/RGB/SRGB.icm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Resources/ColorProfiles/RGB/SRGB.icm -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/SwedenHeart.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/SwedenHeart.eps -------------------------------------------------------------------------------- /tools/Generate.Drawables.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "windows\init.visualstudio.cmd" 3 | 4 | powershell .\FileGenerators\FileGenerator.ps1 -name Drawables 5 | pause -------------------------------------------------------------------------------- /src/Magick.NET/Resources/ColorProfiles/RGB/AppleRGB.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Resources/ColorProfiles/RGB/AppleRGB.icc -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Fonts/KaushanScript-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Fonts/KaushanScript-Regular.ttf -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/CN Studios Logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/CN Studios Logo.ai -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/RowsPerStrip.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/RowsPerStrip.tif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/ConnectedComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/ConnectedComponents.png -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/FujiFilmFinePixS1Pro.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/FujiFilmFinePixS1Pro.gif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/FujiFilmFinePixS1Pro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/FujiFilmFinePixS1Pro.jpg -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/FujiFilmFinePixS1Pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/FujiFilmFinePixS1Pro.png -------------------------------------------------------------------------------- /tools/Generate.MagickScript.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "windows\init.visualstudio.cmd" 3 | 4 | powershell .\FileGenerators\FileGenerator.ps1 -name MagickScript 5 | pause -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Files/FujiFilmFinePixS1Pro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/samples/Magick.NET.Samples/Files/FujiFilmFinePixS1Pro.jpg -------------------------------------------------------------------------------- /src/Magick.NET/Resources/ColorProfiles/RGB/AdobeRGB1998.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Resources/ColorProfiles/RGB/AdobeRGB1998.icc -------------------------------------------------------------------------------- /src/Magick.NET/Resources/ColorProfiles/RGB/ColorMatchRGB.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Resources/ColorProfiles/RGB/ColorMatchRGB.icc -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/layer-styles-sample.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/layer-styles-sample.psd -------------------------------------------------------------------------------- /tools/Generate.Native.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "windows\init.visualstudio.cmd" 3 | 4 | powershell .\FileGenerators\FileGenerator.ps1 -name Native -buildMagickNET $false 5 | pause -------------------------------------------------------------------------------- /src/Magick.NET/Resources/ColorProfiles/CMYK/CoatedFOGRA39.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Resources/ColorProfiles/CMYK/CoatedFOGRA39.icc -------------------------------------------------------------------------------- /src/Magick.NET/Resources/ColorProfiles/CMYK/USWebCoatedSWOP.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/src/Magick.NET/Resources/ColorProfiles/CMYK/USWebCoatedSWOP.icc -------------------------------------------------------------------------------- /tools/Generate.MagickColors.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "windows\init.visualstudio.cmd" 3 | 4 | powershell .\FileGenerators\FileGenerator.ps1 -name MagickColors -buildMagickNET $false 5 | pause -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/pdf-example-password.original.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/pdf-example-password.original.pdf -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NativeDebugTests": { 4 | "commandName": "Project", 5 | "nativeDebugging": true 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Scripts/Wave.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Scripts/Crop.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Images/Coders/Animated_PNG_example_bouncing_beach_ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1kevgriff/Magick.NET/master/tests/Magick.NET.Tests/Images/Coders/Animated_PNG_example_bouncing_beach_ball.png -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask question 4 | url: https://github.com/dlemstra/Magick.NET/discussions/new 5 | about: Ask a question about this project. -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .vs 2 | samples 3 | src/Magick.NET/bin 4 | src/Magick.NET/obj 5 | src/Magick.Native/libraries 6 | src/Magick.Native/resources 7 | TestResults 8 | tests/Magick.NET.Tests/bin 9 | tests/Magick.NET.Tests/obj 10 | tools -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tools/FileGenerators/Native/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tools/FileGenerators/Drawables/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickColors/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /publish/publish.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call "..\tools\windows\init.visualstudio.cmd" 3 | 4 | set PLATFORM_NAME=%2 5 | powershell .\publish.ps1 -destination output -quantumName %1 -platformName %PLATFORM_NAME:"='% 6 | if %errorlevel% neq 0 exit /b %errorlevel% -------------------------------------------------------------------------------- /src/Magick.Native/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Helpers/MagickMemory.json: -------------------------------------------------------------------------------- 1 | { 2 | "static": true, 3 | "access": "internal", 4 | "methods": [ 5 | { 6 | "name": "Relinquish", 7 | "arguments": [ 8 | { 9 | "name": "value", 10 | "type": "Instance" 11 | } 12 | ] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/ImageProfile.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Scripts/Resize.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /publish/push.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo Are you sure? 4 | pause 5 | 6 | set /p ApiKey= 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | .vs 4 | bin 5 | obj 6 | lib 7 | runtimes 8 | /publish/api.key.txt 9 | /src/Magick.Native/libraries 10 | /src/Magick.Native/resources 11 | /samples/Magick.NET.Samples/Samples/Magick.NET/*.pp 12 | /samples/Magick.NET.Samples/Samples/Magick.NET/Files/*.pp 13 | /samples/Magick.NET.Samples/Samples/Magick.NET/Scripts/*.pp 14 | /tools/windows/*.exe 15 | -------------------------------------------------------------------------------- /publish/Magick.NET.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %(FileName)%(Extension) 6 | PreserveNewest 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/PointInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "access": "internal", 4 | "const": true, 5 | "nativeConstructor": true, 6 | "properties": [ 7 | { 8 | "name": "X", 9 | "type": "double", 10 | "readonly": true 11 | }, 12 | { 13 | "name": "Y", 14 | "type": "double", 15 | "readonly": true 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/StringInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "access": "internal", 4 | "const": true, 5 | "nativeConstructor": true, 6 | "properties": [ 7 | { 8 | "name": "Datum", 9 | "type": "Instance", 10 | "readonly": true 11 | }, 12 | { 13 | "name": "Length", 14 | "type": "size_t", 15 | "readonly": true 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /docs/LosslessCompression.md: -------------------------------------------------------------------------------- 1 | # Lossless Compression 2 | 3 | ## Lossless compress JPEG logo 4 | 5 | ```C# 6 | var snakewareLogo = new FileInfo("Snakeware.jpg"); 7 | 8 | Console.WriteLine("Bytes before: " + snakewareLogo.Length); 9 | 10 | var optimizer = new ImageOptimizer(); 11 | optimizer.LosslessCompress(snakewareLogo); 12 | 13 | snakewareLogo.Refresh(); 14 | Console.WriteLine("Bytes after: " + snakewareLogo.Length); 15 | ``` -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/Events.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/MagickRectangle.json: -------------------------------------------------------------------------------- 1 | { 2 | "access": "internal", 3 | "dynamic": "Both", 4 | "properties": [ 5 | { 6 | "name": "X", 7 | "type": "ssize_t" 8 | }, 9 | { 10 | "name": "Y", 11 | "type": "ssize_t" 12 | }, 13 | { 14 | "name": "Width", 15 | "type": "size_t" 16 | }, 17 | { 18 | "name": "Height", 19 | "type": "size_t" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/Resize.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Helpers/Environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "access": "internal", 3 | "static": true, 4 | "methods": [ 5 | { 6 | "name": "Initialize" 7 | }, 8 | { 9 | "name": "SetEnv", 10 | "arguments": [ 11 | { 12 | "name": "name", 13 | "type": "string" 14 | }, 15 | { 16 | "name": "value", 17 | "type": "string" 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/Variables.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/PixelReadSettings.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/Collection.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/OffsetInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "ManagedToNative", 3 | "access": "internal", 4 | "methods": [ 5 | { 6 | "name": "SetX", 7 | "arguments": [ 8 | { 9 | "name": "value", 10 | "type": "size_t" 11 | } 12 | ] 13 | }, 14 | { 15 | "name": "SetY", 16 | "arguments": [ 17 | { 18 | "name": "value", 19 | "type": "size_t" 20 | } 21 | ] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Prerequisites 2 | 3 | - [x] I have written a descriptive pull-request title 4 | - [ ] I have verified that there are no overlapping [pull-requests](https://github.com/dlemstra/Magick.NET/pulls) open 5 | - [ ] I have verified that I am following the existing coding patterns and practices as demonstrated in the repository. 6 | 7 | ### Description 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/Versioning.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | 3 | Magick.NET uses the following versioning strategy: 4 | 5 | IMVERSION.MAJOR.MINOR.PATCH 6 | 7 | - IMVERSION is the version number of ImageMagick (7) 8 | - MAJOR will be incremented when an incompatible API change is made 9 | - MINOR will be incremented when a functionality is added in a backwards-compatible manner 10 | - PATCH will be incremented when only the ImageMagick libraries are rebuild with a newer version 11 | 12 | The AssemblyVersion will only change when IMVERSION, MAJOR or MINOR are modified. -------------------------------------------------------------------------------- /src/Magick.NET/Native/Quantum.json: -------------------------------------------------------------------------------- 1 | { 2 | "static": true, 3 | "methods": [ 4 | { 5 | "name": "ScaleToByte", 6 | "type": "byte", 7 | "arguments": [ 8 | { 9 | "name": "value", 10 | "type": "QuantumType" 11 | } 12 | ] 13 | } 14 | ], 15 | "properties": [ 16 | { 17 | "name": "Depth", 18 | "type": "size_t", 19 | "readonly": true 20 | }, 21 | { 22 | "name": "Max", 23 | "type": "QuantumType", 24 | "readonly": true 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/Distort.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 0 11 | 125 12 | 200 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Scripts/Clone.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Statistics/ChannelPerceptualHash.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "const": true, 4 | "nativeConstructor": true, 5 | "methods": [ 6 | { 7 | "name": "GetSrgbHuPhash", 8 | "type": "double", 9 | "arguments": [ 10 | { 11 | "name": "index", 12 | "type": "size_t" 13 | } 14 | ] 15 | }, 16 | { 17 | "name": "GetHclpHuPhash", 18 | "type": "double", 19 | "arguments": [ 20 | { 21 | "name": "index", 22 | "type": "size_t" 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | ### Is your feature request related to a problem? Please describe 8 | 9 | 10 | ### Describe the solution you'd like 11 | 12 | 13 | ### Describe alternatives you've considered 14 | 15 | 16 | ### Additional context 17 | -------------------------------------------------------------------------------- /docs/ReadRawImageFromCamera.md: -------------------------------------------------------------------------------- 1 | # Read raw image from camera 2 | 3 | ## Installation 4 | If you wish to use `dcraw.exe` instead of the build in libraw library you will need to put the executable `dcraw.exe` 5 | into the directory that contains the Magick.NET dll. The zip file `ImageMagick-7.X.X-X-Q16-x86-windows.zip` 6 | that you can download from http://www.imagemagick.org/script/binary-releases.php#windows contains this file. 7 | To force the use of dcraw the `Format` in the `MagickReadSettings` should be set to `MagickFormat.Dcraw`. 8 | 9 | ## Convert CR2 to JPG 10 | 11 | ```C# 12 | using (var image = new MagickImage("StillLife.CR2")) 13 | { 14 | image.Write("StillLife.jpg"); 15 | } 16 | ``` -------------------------------------------------------------------------------- /src/Magick.NET/Native/OpenCL/OpenCLKernelProfileRecord.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "const": true, 4 | "properties": [ 5 | { 6 | "name": "Count", 7 | "type": "long", 8 | "readonly": true 9 | }, 10 | { 11 | "name": "MaximumDuration", 12 | "type": "long", 13 | "readonly": true 14 | }, 15 | { 16 | "name": "MinimumDuration", 17 | "type": "long", 18 | "readonly": true 19 | }, 20 | { 21 | "name": "Name", 22 | "type": "string", 23 | "readonly": true 24 | }, 25 | { 26 | "name": "TotalDuration", 27 | "type": "long", 28 | "readonly": true 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Statistics/Moments.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "instance": false, 4 | "methods": [ 5 | { 6 | "name": "DisposeList", 7 | "static": true, 8 | "arguments": [ 9 | { 10 | "name": "list", 11 | "type": "Instance" 12 | } 13 | ] 14 | }, 15 | { 16 | "name": "GetInstance", 17 | "type": "Instance", 18 | "static": true, 19 | "arguments": [ 20 | { 21 | "name": "list", 22 | "type": "Instance" 23 | }, 24 | { 25 | "name": "channel", 26 | "type": "PixelChannel" 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Statistics/Statistics.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "instance": false, 4 | "methods": [ 5 | { 6 | "name": "DisposeList", 7 | "static": true, 8 | "arguments": [ 9 | { 10 | "name": "list", 11 | "type": "Instance" 12 | } 13 | ] 14 | }, 15 | { 16 | "name": "GetInstance", 17 | "type": "Instance", 18 | "static": true, 19 | "arguments": [ 20 | { 21 | "name": "list", 22 | "type": "Instance" 23 | }, 24 | { 25 | "name": "channel", 26 | "type": "PixelChannel" 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /docs/DetailedDebugInformation.md: -------------------------------------------------------------------------------- 1 | # Detailed debug information 2 | 3 | ## Get detailed debug information from ImageMagick 4 | 5 | ```C# 6 | public void MagickNET_Log(object sender, LogEventArgs arguments) 7 | { 8 | // Write log message 9 | WriteLogMessage(arguments.Message); 10 | } 11 | 12 | public void ReadImage() 13 | { 14 | // Log all events 15 | MagickNET.SetLogEvents(LogEvents.All); 16 | // Set the log handler (all threads use the same handler) 17 | MagickNET.Log += MagickNET_Log; 18 | 19 | using (var image = new MagickImage()) 20 | { 21 | // Reading the image will send all log events to the log handler 22 | image.Read("Snakeware.png"); 23 | } 24 | } 25 | ``` -------------------------------------------------------------------------------- /src/Magick.NET/Native/Colors/MagickColorCollection.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "access": "internal", 4 | "static": true, 5 | "methods": [ 6 | { 7 | "name": "DisposeList", 8 | "static": true, 9 | "arguments": [ 10 | { 11 | "name": "list", 12 | "type": "Instance" 13 | } 14 | ] 15 | }, 16 | { 17 | "name": "GetInstance", 18 | "type": "Instance", 19 | "static": true, 20 | "arguments": [ 21 | { 22 | "name": "list", 23 | "type": "Instance" 24 | }, 25 | { 26 | "name": "index", 27 | "type": "size_t" 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute to Magick.NET 2 | 3 | #### Did you find a bug? 4 | 5 | - Please ensure the bug was not already reported by searching our [issues](https://github.com/dlemstra/Magick.NET/issues). 6 | - If you're unable to find an open issue addressing the problem, please [open a new one](https://github.com/dlemstra/Magick.NET/issues/new/choose). 7 | Be sure to follow the instructions in the issue template. 8 | 9 | #### Did you write a patch that fixes a bug? 10 | 11 | - Open a new pull request with the patch and follow the instructions from the pull request template. 12 | - Before submitting, please ensure that your code matches the existing coding patterns and practise as demonstrated in the repository. 13 | -------------------------------------------------------------------------------- /tests/Magick.NET.ruleset: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/MagickGeometry.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "properties": [ 4 | { 5 | "name": "X", 6 | "type": "double", 7 | "readonly": true 8 | }, 9 | { 10 | "name": "Y", 11 | "type": "double", 12 | "readonly": true 13 | }, 14 | { 15 | "name": "Width", 16 | "type": "double", 17 | "readonly": true 18 | }, 19 | { 20 | "name": "Height", 21 | "type": "double", 22 | "readonly": true 23 | } 24 | ], 25 | "methods": [ 26 | { 27 | "name": "Initialize", 28 | "type": "GeometryFlags", 29 | "arguments": [ 30 | { 31 | "name": "value", 32 | "type": "string" 33 | } 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Magick.NET.Samples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net40 4 | bin\$(Configuration)\$(Platform)\ 5 | Dirk Lemstra 6 | Copyright 2013-2020 Dirk Lemstra 7 | DebugQ8;DebugQ16;DebugQ16-HDRI;TestQ8;TestQ16;TestQ16-HDRI;ReleaseQ8;ReleaseQ16;ReleaseQ16-HDRI 8 | x86;x64;AnyCPU 9 | 10 | 11 | 12 | CS0618 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Statistics/PerceptualHash.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "instance": false, 4 | "methods": [ 5 | { 6 | "name": "DisposeList", 7 | "static": true, 8 | "arguments": [ 9 | { 10 | "name": "list", 11 | "type": "Instance" 12 | } 13 | ] 14 | }, 15 | { 16 | "name": "GetInstance", 17 | "type": "Instance", 18 | "static": true, 19 | "arguments": [ 20 | { 21 | "name": "image", 22 | "type": "IMagickImage" 23 | }, 24 | { 25 | "name": "list", 26 | "type": "Instance" 27 | }, 28 | { 29 | "name": "channel", 30 | "type": "PixelChannel" 31 | } 32 | ] 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /docs/Watermark.md: -------------------------------------------------------------------------------- 1 | # Watermark 2 | 3 | ```C# 4 | // Read image that needs a watermark 5 | using (var image = new MagickImage("Snakeware.jpg")) 6 | { 7 | // Read the watermark that will be put on top of the image 8 | using (var watermark = new MagickImage("Magick.NET.png")) 9 | { 10 | // Draw the watermark in the bottom right corner 11 | image.Composite(watermark, Gravity.Southeast, CompositeOperator.Over); 12 | 13 | // Optionally make the watermark more transparent 14 | watermark.Evaluate(Channels.Alpha, EvaluateOperator.Divide, 4); 15 | 16 | // Or draw the watermark at a specific location 17 | image.Composite(watermark, 200, 50, CompositeOperator.Over); 18 | } 19 | 20 | // Save the result 21 | image.Write("Snakeware.watermark.jpg"); 22 | } 23 | ``` -------------------------------------------------------------------------------- /tools/FileGenerators/Shared/QuantumDepth.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator 14 | { 15 | public enum QuantumDepth 16 | { 17 | Q8, 18 | Q16, 19 | Q16HDRI 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/OpenCL/OpenCL.json: -------------------------------------------------------------------------------- 1 | { 2 | "static": true, 3 | "methods": [ 4 | { 5 | "name": "GetDevices", 6 | "type": "Instance", 7 | "arguments": [ 8 | { 9 | "name": "length", 10 | "type": "size_t", 11 | "out": true 12 | } 13 | ] 14 | }, 15 | { 16 | "name": "GetDevice", 17 | "type": "Instance", 18 | "static": true, 19 | "arguments": [ 20 | { 21 | "name": "list", 22 | "type": "Instance" 23 | }, 24 | { 25 | "name": "index", 26 | "type": "size_t" 27 | } 28 | ] 29 | }, 30 | { 31 | "name": "SetEnabled", 32 | "type": "bool", 33 | "arguments": [ 34 | { 35 | "name": "value", 36 | "type": "bool" 37 | } 38 | ] 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /src/Magick.Native/libraries.md: -------------------------------------------------------------------------------- 1 | # Libraries 2 | Magick.Native is build with the following libraries: 3 | 4 | - cairo 1.14.6 (9 December 2015) 5 | - croco 0.6.9 6 | - exr 2.3.0 (10 August 2018) 7 | - ffi 3.2.1 8 | - flif 0.3.0 (28 April 2017) 9 | - freetype 2.10.0 (15 March 2019) 10 | - glib 2.53.6 (19 August 2017) 11 | - ImageMagick 7.0.10-13 12 | - jp2 2.0.14 (14 September 2017) 13 | - jpeg 2.0.2 (14 February 2019) 14 | - lcms 2.9 (6 November 2017) 15 | - libde265 1.0.4 (19 December 2019) 16 | - libheif 1.6.1 (19 December 2019) 17 | - libraw 0.19.2 (24 December 2018) 18 | - librsvg 2.40.20 (15 December 2017) 19 | - libxml 2.9.10 (30 Oct 2019) 20 | - lqr 0.4.2 (4 December 2012) 21 | - openjpeg 2.3.1 (26 February 2019) 22 | - pango 1.42.4 (20 August 2018) 23 | - pixman 0.30.2 24 | - png 1.6.37 (16 July 2018) 25 | - tiff 4.0.10 (11 November 2018) 26 | - webp 1.0.3 (7 April 2019) 27 | - zlib 1.2.11 (15 January 2017) 28 | -------------------------------------------------------------------------------- /tools/FileGenerators/Native/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.Native 14 | { 15 | internal sealed class Program 16 | { 17 | internal static void Main() 18 | { 19 | NativeGenerator.Create(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Defines/IReadDefines.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Interface for defines that are used when reading an image. 17 | /// 18 | public interface IReadDefines : IDefines 19 | { 20 | } 21 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Helpers/ValidatedNotNullAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | [AttributeUsage(AttributeTargets.Parameter)] 18 | internal sealed class ValidatedNotNullAttribute : Attribute 19 | { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/GifOptimizerTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick.ImageOptimizers; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class GifOptimizerTests : ImageOptimizerTestHelper 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/IcoOptimizerTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick.ImageOptimizers; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class IcoOptimizerTests : ImageOptimizerTestHelper 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/JpegOptimizerTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick.ImageOptimizers; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class JpegOptimizerTests : ImageOptimizerTestHelper 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/PngOptimizerTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick.ImageOptimizers; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class PngOptimizerTests : ImageOptimizerTestHelper 18 | { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/ResourceLimits.json: -------------------------------------------------------------------------------- 1 | { 2 | "static": true, 3 | "properties": [ 4 | { 5 | "name": "Area", 6 | "type": "ulong" 7 | }, 8 | { 9 | "name": "Disk", 10 | "type": "ulong" 11 | }, 12 | { 13 | "name": "Height", 14 | "type": "ulong" 15 | }, 16 | { 17 | "name": "ListLength", 18 | "type": "ulong" 19 | }, 20 | { 21 | "name": "Memory", 22 | "type": "ulong" 23 | }, 24 | { 25 | "name": "Thread", 26 | "type": "ulong" 27 | }, 28 | { 29 | "name": "Throttle", 30 | "type": "ulong" 31 | }, 32 | { 33 | "name": "Width", 34 | "type": "ulong" 35 | } 36 | ], 37 | "methods": [ 38 | { 39 | "name": "LimitMemory", 40 | "arguments": [ 41 | { 42 | "name": "percentage", 43 | "type": "double" 44 | } 45 | ] 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/TypeMetric.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "noConstructor": true, 4 | "properties": [ 5 | { 6 | "name": "Ascent", 7 | "type": "double", 8 | "readonly": true 9 | }, 10 | { 11 | "name": "Descent", 12 | "type": "double", 13 | "readonly": true 14 | }, 15 | { 16 | "name": "MaxHorizontalAdvance", 17 | "type": "double", 18 | "readonly": true 19 | }, 20 | { 21 | "name": "TextHeight", 22 | "type": "double", 23 | "readonly": true 24 | }, 25 | { 26 | "name": "TextWidth", 27 | "type": "double", 28 | "readonly": true 29 | }, 30 | { 31 | "name": "UnderlinePosition", 32 | "type": "double", 33 | "readonly": true 34 | }, 35 | { 36 | "name": "UnderlineThickness", 37 | "type": "double", 38 | "readonly": true 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /tools/FileGenerators/Drawables/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.Drawables 14 | { 15 | internal sealed class Program 16 | { 17 | internal static void Main() 18 | { 19 | DrawableAppDomainHelper.Execute(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class Program 16 | { 17 | internal static void Main() 18 | { 19 | ScriptAppDomainHelper.Execute(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Script/Draw.msl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickColors/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickColors 14 | { 15 | internal sealed class Program 16 | { 17 | internal static void Main() 18 | { 19 | MagickColorsGenerator.Generate(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docs/Defines.md: -------------------------------------------------------------------------------- 1 | # Defines 2 | 3 | ## Command line option -define 4 | 5 | ```C# 6 | // Read image from file 7 | using (var image = new MagickImage("Snakeware.png")) 8 | { 9 | // Tells the dds coder to use dxt1 compression when writing the image 10 | image.Settings.SetDefine(MagickFormat.Dds, "compression", "dxt1"); 11 | // Write the image 12 | image.Write("Snakeware.dds"); 13 | } 14 | ``` 15 | 16 | ## Defines that need to be set before reading an image 17 | 18 | ```C# 19 | var settings = new MagickReadSettings(); 20 | // Set define that tells the jpeg coder that the output image will be 32x32 21 | settings.SetDefine(MagickFormat.Jpeg, "size", "32x32"); 22 | 23 | // Read image from file 24 | using (var image = new MagickImage("Snakeware.jpg")) 25 | { 26 | // Create thumnail that is 32 pixels wide and 32 pixels high 27 | image.Thumbnail(32,32); 28 | // Save image as tiff 29 | image.Write("Snakeware.tiff"); 30 | } 31 | ``` -------------------------------------------------------------------------------- /src/Magick.NET/Core/AnyCPU/NativeLibraryLoader.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if PLATFORM_AnyCPU && NETSTANDARD 14 | 15 | namespace ImageMagick 16 | { 17 | internal static class NativeLibraryLoader 18 | { 19 | public static void Load() 20 | { 21 | } 22 | } 23 | } 24 | 25 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Core/Attributes/NonSerializedAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NETSTANDARD1_3 14 | 15 | namespace System 16 | { 17 | [AttributeUsage(AttributeTargets.Field, Inherited = false)] 18 | internal sealed class NonSerializedAttribute : Attribute 19 | { 20 | } 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Tags/UnkownExifTag.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class UnkownExifTag : ExifTag 16 | { 17 | internal UnkownExifTag(ExifTagValue value) 18 | : base((ushort)value) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/DeskewSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class DeskewSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "DeskewSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/KmeansSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class KmeansSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "KmeansSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/Native/Data/DynamicMode.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace FileGenerator.Native 16 | { 17 | [Flags] 18 | public enum DynamicMode 19 | { 20 | None = 0, 21 | NativeToManaged = 1, 22 | ManagedToNative = 2, 23 | Both = 3 24 | } 25 | } -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/ComplexSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class ComplexSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "ComplexSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/DistortSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class DistortSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "DistortSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/MontageSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class MontageSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "MontageSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/PixelReadSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class PixelReadSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "PixelReadSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/QuantizeSettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class QuantizeSettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "QuantizeSettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /publish/set.version.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2013-2020 Dirk Lemstra 2 | # 3 | # Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | # compliance with the License. You may obtain a copy of the License at 5 | # 6 | # https://www.imagemagick.org/script/license.php 7 | # 8 | # Unless required by applicable law or agreed to in writing, software distributed under the 9 | # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | # either express or implied. See the License for the specific language governing permissions 11 | # and limitations under the License. 12 | 13 | & cmd /c 'git describe --exact-match --tags HEAD > tag.txt 2> nul' 14 | 15 | $tag = [IO.File]::ReadAllText("tag.txt").Trim() 16 | 17 | if ($tag.Length -eq 0) { 18 | $tag = Get-Date -Format "yyyy.MM.dd.HHmm" 19 | } 20 | 21 | Write-Host "::set-env name=NuGetVersion::$tag" 22 | 23 | Exit 0 24 | -------------------------------------------------------------------------------- /tools/FileGenerators/MagickScript/Code/Settings/MorphologySettingsGenerator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace FileGenerator.MagickScript 14 | { 15 | internal sealed class MorphologySettingsGenerator : CreateObjectCodeGenerator 16 | { 17 | public override string ClassName => "MorphologySettings"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Helpers/MagickMemory.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | internal static partial class MagickMemory 18 | { 19 | public static void Relinquish(IntPtr value) 20 | { 21 | NativeMagickMemory.Relinquish(value); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Extensions/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NET20 14 | namespace System.Runtime.CompilerServices 15 | { 16 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | 17 | AttributeTargets.Method)] 18 | internal sealed class ExtensionAttribute : Attribute 19 | { 20 | } 21 | } 22 | #endif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/TestIssue.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick; 14 | using Microsoft.VisualStudio.TestTools.UnitTesting; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | [TestClass] 19 | public class TestIssue 20 | { 21 | [TestMethod] 22 | public void RunTest() 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Magick.NET/Core/Helpers/FileHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NETSTANDARD 14 | 15 | using System.IO; 16 | using System.Threading.Tasks; 17 | 18 | namespace ImageMagick 19 | { 20 | internal static partial class FileHelper 21 | { 22 | public static string CheckForBaseDirectory(string fileName) => fileName; 23 | } 24 | } 25 | 26 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Native/Statistics/ChannelMoments.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "NativeToManaged", 3 | "const": true, 4 | "nativeConstructor": true, 5 | "properties": [ 6 | { 7 | "name": "Centroid", 8 | "type": "PointInfo", 9 | "readonly": true 10 | }, 11 | { 12 | "name": "EllipseAngle", 13 | "type": "double", 14 | "readonly": true 15 | }, 16 | { 17 | "name": "EllipseAxis", 18 | "type": "PointInfo", 19 | "readonly": true 20 | }, 21 | { 22 | "name": "EllipseEccentricity", 23 | "type": "double", 24 | "readonly": true 25 | }, 26 | { 27 | "name": "EllipseIntensity", 28 | "type": "double", 29 | "readonly": true 30 | } 31 | ], 32 | "methods": [ 33 | { 34 | "name": "GetHuInvariants", 35 | "type": "double", 36 | "arguments": [ 37 | { 38 | "name": "index", 39 | "type": "size_t" 40 | } 41 | ] 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /src/Magick.NET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.Runtime.InteropServices; 15 | #if NET20 16 | using System.Security.Permissions; 17 | #endif 18 | 19 | [assembly: ComVisible(false)] 20 | [assembly: CLSCompliant(false)] 21 | #if NET20 22 | [assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)] 23 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Core/Attributes/SerializableAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NETSTANDARD1_3 14 | 15 | namespace System 16 | { 17 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)] 18 | internal sealed class SerializableAttribute : Attribute 19 | { 20 | } 21 | } 22 | 23 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Drawables/Coordinates/PathArcCoordinates.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Collections.Generic; 14 | 15 | namespace ImageMagick 16 | { 17 | internal class PathArcCoordinates : DrawableCoordinates 18 | { 19 | public PathArcCoordinates(IEnumerable coordinates) 20 | : base(coordinates, 0) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifFloatArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifFloatArray : ExifArrayValue 16 | { 17 | public ExifFloatArray(ExifTagValue tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public override ExifDataType DataType => ExifDataType.Float; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/ImageOptimizerTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.IO; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class ImageOptimizerTests 18 | { 19 | private static FileStream OpenStream(string path) 20 | { 21 | return File.Open(path, FileMode.Open, FileAccess.ReadWrite); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Drawables/Paths/IPath.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Diagnostics.CodeAnalysis; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Marker interface for paths. 19 | /// 20 | [SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "This is a marker interface.")] 21 | public interface IPath 22 | { 23 | } 24 | } -------------------------------------------------------------------------------- /tools/FileGenerators/Shared/PathHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.IO; 15 | 16 | namespace FileGenerator 17 | { 18 | public static class PathHelper 19 | { 20 | public static string GetFullPath(string path) 21 | { 22 | return Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory + @"..\..\..\..\..\" + path); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Drawables/IDrawable.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Diagnostics.CodeAnalysis; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Marker interface for drawables. 19 | /// 20 | [SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "This is a marker interface.")] 21 | public interface IDrawable 22 | { 23 | } 24 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifSignedByteArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifSignedByteArray : ExifArrayValue 16 | { 17 | public ExifSignedByteArray(ExifTagValue tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public override ExifDataType DataType => ExifDataType.SignedByte; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifSignedLongArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifSignedLongArray : ExifArrayValue 16 | { 17 | public ExifSignedLongArray(ExifTagValue tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public override ExifDataType DataType => ExifDataType.SignedLong; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifSignedShortArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifSignedShortArray : ExifArrayValue 16 | { 17 | public ExifSignedShortArray(ExifTagValue tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public override ExifDataType DataType => ExifDataType.SignedShort; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Settings/QuantizeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "ManagedToNative", 3 | "methods": [ 4 | { 5 | "name": "SetColors", 6 | "arguments": [ 7 | { 8 | "name": "value", 9 | "type": "size_t" 10 | } 11 | ] 12 | }, 13 | { 14 | "name": "SetColorSpace", 15 | "arguments": [ 16 | { 17 | "name": "value", 18 | "type": "ColorSpace" 19 | } 20 | ] 21 | }, 22 | { 23 | "name": "SetDitherMethod", 24 | "arguments": [ 25 | { 26 | "name": "value", 27 | "type": "DitherMethod" 28 | } 29 | ] 30 | }, 31 | { 32 | "name": "SetMeasureErrors", 33 | "arguments": [ 34 | { 35 | "name": "value", 36 | "type": "bool" 37 | } 38 | ] 39 | }, 40 | { 41 | "name": "SetTreeDepth", 42 | "arguments": [ 43 | { 44 | "name": "value", 45 | "type": "size_t" 46 | } 47 | ] 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Types/PointInfoCollection.json: -------------------------------------------------------------------------------- 1 | { 2 | "access": "internal", 3 | "nativeConstructor": true, 4 | "constructor": { 5 | "arguments": [ 6 | { 7 | "name": "length", 8 | "type": "size_t" 9 | } 10 | ] 11 | }, 12 | "methods": [ 13 | { 14 | "name": "GetX", 15 | "type": "double", 16 | "arguments": [ 17 | { 18 | "name": "index", 19 | "type": "size_t" 20 | } 21 | ] 22 | }, 23 | { 24 | "name": "GetY", 25 | "type": "double", 26 | "arguments": [ 27 | { 28 | "name": "index", 29 | "type": "size_t" 30 | } 31 | ] 32 | }, 33 | { 34 | "name": "Set", 35 | "arguments": [ 36 | { 37 | "name": "index", 38 | "type": "size_t" 39 | }, 40 | { 41 | "name": "x", 42 | "type": "double" 43 | }, 44 | { 45 | "name": "y", 46 | "type": "double" 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/INativeInstance.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Interface for a native instance. 19 | /// 20 | internal interface INativeInstance : IDisposable 21 | { 22 | /// 23 | /// Gets a pointer to the native instance. 24 | /// 25 | IntPtr Instance { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Tags/ExifTag.SignedRationalArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | public abstract partial class ExifTag 17 | { 18 | /// 19 | /// Gets the Decode exif tag. 20 | /// 21 | public static ExifTag Decode { get; } = new ExifTag(ExifTagValue.Decode); 22 | } 23 | } -------------------------------------------------------------------------------- /tools/FileGenerators/Shared/AppDomain/ApplicationProxy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.Reflection; 15 | 16 | namespace FileGenerator 17 | { 18 | public abstract class ApplicationProxy : MarshalByRefObject 19 | { 20 | protected Assembly ResolveAssembly(object sender, ResolveEventArgs args) 21 | { 22 | return Assembly.ReflectionOnlyLoad(args.Name); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Defines/IWriteDefines.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Interface for defines that are used when writing an image. 17 | /// 18 | public interface IWriteDefines : IDefines 19 | { 20 | /// 21 | /// Gets the format where the defines are for. 22 | /// 23 | MagickFormat Format { get; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Extensions/INativeInstanceExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | internal static class INativeInstanceExtensions 18 | { 19 | internal static IntPtr GetInstance(this INativeInstance self) 20 | { 21 | if (self == null) 22 | return IntPtr.Zero; 23 | 24 | return self.Instance; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | ### Prerequisites 8 | 9 | - [x] I have written a descriptive issue title 10 | - [ ] I have verified that I am using the latest version of Magick.NET 11 | - [ ] I have searched [open](https://github.com/dlemstra/Magick.NET/issues) and [closed](https://github.com/dlemstra/Magick.NET/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported 12 | 13 | ### Description 14 | 15 | 16 | ### Steps to Reproduce 17 | 19 | 20 | ### System Configuration 21 | 22 | 23 | - Magick.NET version: 24 | - Environment (Operating system, version and so on): 25 | - Additional information: 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/EventArgs/ArtifactEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | internal sealed class ArtifactEventArgs : EventArgs 18 | { 19 | internal ArtifactEventArgs(string key, string value) 20 | { 21 | Key = key; 22 | Value = value; 23 | } 24 | 25 | public string Key { get; } 26 | 27 | public string Value { get; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Formats/Dds/DdsCompression.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Formats.Dds 14 | { 15 | /// 16 | /// Specifies dds compression methods. 17 | /// 18 | public enum DdsCompression 19 | { 20 | /// 21 | /// None 22 | /// 23 | None, 24 | 25 | /// 26 | /// Dxt1 27 | /// 28 | Dxt1, 29 | } 30 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Drawables/IDrawingWand.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Interface for drawing on an wand. 17 | /// 18 | internal interface IDrawingWand 19 | { 20 | /// 21 | /// Draws this instance with the drawing wand. 22 | /// 23 | /// The wand to draw on. 24 | void Draw(DrawingWand wand); 25 | } 26 | } -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/ExcludeFromCodeCoverageAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event, Inherited = false, AllowMultiple = false)] 18 | internal sealed class ExcludeFromCodeCoverageAttribute : Attribute 19 | { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/ResourceLimitsTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class ResourceLimitsTests 18 | { 19 | private static readonly object _lock = new object(); 20 | 21 | private static void ExecuteInsideLock(Action action) 22 | { 23 | lock (_lock) 24 | { 25 | action(); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/UsingColors.md: -------------------------------------------------------------------------------- 1 | # Using colors 2 | 3 | ```C# 4 | using (var image = new MagickImage("Snakeware.png")) 5 | { 6 | image.TransparentChroma(Color.Black, Color.Blue); 7 | image.BackgroundColor = new ColorMono(true); 8 | 9 | // Q16 (Blue): 10 | image.TransparentChroma(new MagickColor(0, 0, 0), new MagickColor(0, 0, Quantum.Max)); 11 | image.TransparentChroma(new ColorRGB(0, 0, 0), new ColorRGB(0, 0, Quantum.Max)); 12 | image.BackgroundColor = new MagickColor("#00f"); 13 | image.BackgroundColor = new MagickColor("#0000ff"); 14 | image.BackgroundColor = new MagickColor("#00000000ffff"); 15 | 16 | // With transparency (Red): 17 | image.BackgroundColor = new MagickColor(0, 0, Quantum.Max, 0); 18 | image.BackgroundColor = new MagickColor("#0000ff80"); 19 | 20 | // Q8 (Green): 21 | image.TransparentChroma(new MagickColor(0, 0, 0), new MagickColor(0, Quantum.Max, 0)); 22 | image.TransparentChroma(new ColorRGB(0, 0, 0), new ColorRGB(0, Quantum.Max, 0)); 23 | image.BackgroundColor = new MagickColor("#0f0"); 24 | image.BackgroundColor = new MagickColor("#00ff00"); 25 | } 26 | ``` -------------------------------------------------------------------------------- /samples/Magick.NET.Samples/Program.cs: -------------------------------------------------------------------------------- 1 | //================================================================================================= 2 | // Copyright 2013-2020 Dirk Lemstra 3 | // 4 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 5 | // compliance with the License. You may obtain a copy of the License at 6 | // 7 | // https://www.imagemagick.org/script/license.php 8 | // 9 | // Unless required by applicable law or agreed to in writing, software distributed under the 10 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 11 | // express or implied. See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | //================================================================================================= 14 | 15 | using System; 16 | 17 | namespace Magick.NET.Samples 18 | { 19 | class Program 20 | { 21 | static void Main(string[] args) 22 | { 23 | Console.Read(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Profiles/Exif/ExifProfileTests/Init.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick; 14 | using Microsoft.VisualStudio.TestTools.UnitTesting; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | public partial class ExifProfileTests 19 | { 20 | private static void TestValue(IExifValue value, string expected) 21 | { 22 | Assert.IsNotNull(value); 23 | Assert.AreEqual(expected, value.GetValue()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tools/windows/FileGenerator.Drawables.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2013-2020 Dirk Lemstra 2 | # 3 | # Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | # compliance with the License. You may obtain a copy of the License at 5 | # 6 | # https://www.imagemagick.org/script/license.php 7 | # 8 | # Unless required by applicable law or agreed to in writing, software distributed under the 9 | # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | # either express or implied. See the License for the specific language governing permissions 11 | # and limitations under the License. 12 | 13 | param ( 14 | [string]$config = "Release", 15 | [string]$quantumName = $env:QuantumName, 16 | [string]$platformName = $env:PlatformName 17 | ) 18 | 19 | . $PSScriptRoot\..\..\tools\windows\utils.ps1 20 | 21 | function buildMagickNET($config, $quantumName, $platformName) { 22 | buildSolution "Magick.NET.sln" "Configuration=$config$quantumName,Platform=$platformName" 23 | } 24 | 25 | buildMagickNET $config $quantumName $platformName -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Defines/IDefines.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Collections.Generic; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Interface for an object that specifies defines for an image. 19 | /// 20 | public interface IDefines 21 | { 22 | /// 23 | /// Gets the defines that should be set as a define on an image. 24 | /// 25 | IEnumerable Defines { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /docs/ExceptionHandling.md: -------------------------------------------------------------------------------- 1 | # Exception handling 2 | 3 | ## Exception handling 4 | 5 | ```C# 6 | try 7 | { 8 | // Read invalid jpg file 9 | using (var image = new MagickImage("InvalidFile.jpg")) 10 | { 11 | } 12 | } 13 | // Catch any MagickException 14 | catch (MagickException exception) 15 | { 16 | // Write excepion raised when reading the invalid jpg to the console 17 | Console.WriteLine(exception.Message); 18 | } 19 | 20 | try 21 | { 22 | // Read corrupt jpg file 23 | using (var image = new MagickImage("CorruptImage.jpg")) 24 | { 25 | } 26 | } 27 | // Catch only MagickCorruptImageErrorException 28 | catch (MagickCorruptImageErrorException exception) 29 | { 30 | // Write excepion raised when reading the corrupt jpg to the console 31 | Console.WriteLine(exception.Message); 32 | } 33 | ``` 34 | 35 | ## Obtain warning that occurred during reading 36 | 37 | ```C# 38 | using (var image = new MagickImage()) 39 | { 40 | // Attach event handler to warning event 41 | image.Warning += MagickImage_Warning; 42 | // Read file that will raise a warning. 43 | image.Read("FileWithWarning.jpg"); 44 | } 45 | ``` -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifLongArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifLongArray : ExifArrayValue 16 | { 17 | public ExifLongArray(ExifTag tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public ExifLongArray(ExifTagValue tag) 23 | : base(tag) 24 | { 25 | } 26 | 27 | public override ExifDataType DataType => ExifDataType.Long; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/IExifValue{TValueType}.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// A value of the exif profile. 17 | /// 18 | /// The type of the value. 19 | public interface IExifValue : IExifValue 20 | { 21 | /// 22 | /// Gets or sets the value. 23 | /// 24 | TValueType Value { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/Endian.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies endian. 17 | /// 18 | public enum Endian 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// LSB 27 | /// 28 | LSB, 29 | 30 | /// 31 | /// MSB 32 | /// 33 | MSB, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifShortArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifShortArray : ExifArrayValue 16 | { 17 | public ExifShortArray(ExifTag tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public ExifShortArray(ExifTagValue tag) 23 | : base(tag) 24 | { 25 | } 26 | 27 | public override ExifDataType DataType => ExifDataType.Short; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Helpers/ByteConverterTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using ImageMagick; 15 | using Microsoft.VisualStudio.TestTools.UnitTesting; 16 | 17 | namespace Magick.NET.Tests 18 | { 19 | [TestClass] 20 | public class ByteConverterTests 21 | { 22 | [TestMethod] 23 | public void Test_ToArray() 24 | { 25 | byte[] value = ByteConverter.ToArray(IntPtr.Zero, 4); 26 | Assert.AreEqual(null, value); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifDoubleArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifDoubleArray : ExifArrayValue 16 | { 17 | public ExifDoubleArray(ExifTag tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public ExifDoubleArray(ExifTagValue tag) 23 | : base(tag) 24 | { 25 | } 26 | 27 | public override ExifDataType DataType => ExifDataType.Double; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Helpers/ShortConverterTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using ImageMagick; 15 | using Microsoft.VisualStudio.TestTools.UnitTesting; 16 | 17 | namespace Magick.NET.Tests 18 | { 19 | [TestClass] 20 | public class ShortConverterTests 21 | { 22 | [TestMethod] 23 | public void Test_ToArray() 24 | { 25 | ushort[] value = ShortConverter.ToArray(IntPtr.Zero, 4); 26 | Assert.AreEqual(null, value); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifByteArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifByteArray : ExifArrayValue 16 | { 17 | public ExifByteArray(ExifTag tag, ExifDataType dataType) 18 | : base(tag) => DataType = dataType; 19 | 20 | public ExifByteArray(ExifTagValue tag, ExifDataType dataType) 21 | : base(tag) => DataType = dataType; 22 | 23 | public override ExifDataType DataType { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/NonSeekableStream.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.IO; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | [ExcludeFromCodeCoverage] 18 | internal sealed class NonSeekableStream : TestStream 19 | { 20 | public NonSeekableStream(string fileName) 21 | : base(File.OpenRead(fileName), false) 22 | { 23 | } 24 | 25 | public NonSeekableStream(Stream innerStream) 26 | : base(innerStream, false) 27 | { 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Magick.NET/Framework/Extensions/StreamExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NET20 14 | using System.IO; 15 | 16 | namespace ImageMagick 17 | { 18 | internal static class StreamExtensions 19 | { 20 | public static void CopyTo(this Stream self, Stream output) 21 | { 22 | var buffer = new byte[81920]; 23 | int len; 24 | 25 | while ((len = self.Read(buffer, 0, buffer.Length)) > 0) 26 | output.Write(buffer, 0, len); 27 | } 28 | } 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/FillRule.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies fill rule. 17 | /// 18 | public enum FillRule 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// EvenOdd 27 | /// 28 | EvenOdd, 29 | 30 | /// 31 | /// Nonzero 32 | /// 33 | Nonzero, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifRationalArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifRationalArray : ExifArrayValue 16 | { 17 | public ExifRationalArray(ExifTag tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public ExifRationalArray(ExifTagValue tag) 23 | : base(tag) 24 | { 25 | } 26 | 27 | public override ExifDataType DataType => ExifDataType.Rational; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifSignedLong.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Globalization; 14 | 15 | namespace ImageMagick 16 | { 17 | internal sealed class ExifSignedLong : ExifValue 18 | { 19 | public ExifSignedLong(ExifTagValue tag) 20 | : base(tag) 21 | { 22 | } 23 | 24 | public override ExifDataType DataType => ExifDataType.SignedLong; 25 | 26 | protected override string StringValue => Value.ToString(CultureInfo.InvariantCulture); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/ClassType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies the image class type. 17 | /// 18 | public enum ClassType 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Direct 27 | /// 28 | Direct, 29 | 30 | /// 31 | /// Pseudo 32 | /// 33 | Pseudo, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/OpenCLDeviceType.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies the OpenCL device types. 17 | /// 18 | public enum OpenCLDeviceType 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Cpu 27 | /// 28 | Cpu, 29 | 30 | /// 31 | /// Gpu 32 | /// 33 | Gpu, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Formats/Jpeg/JpegDctMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Formats.Jpeg 14 | { 15 | /// 16 | /// Specifies the DCT method. 17 | /// 18 | public enum JpegDctMethod 19 | { 20 | /// 21 | /// Fast 22 | /// 23 | Fast, 24 | 25 | /// 26 | /// Float 27 | /// 28 | Float, 29 | 30 | /// 31 | /// Slow 32 | /// 33 | Slow, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/LayerMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal enum LayerMethod 16 | { 17 | Undefined, 18 | Coalesce, 19 | CompareAny, 20 | CompareClear, 21 | CompareOverlay, 22 | Dispose, 23 | Optimize, 24 | OptimizeImage, 25 | OptimizePlus, 26 | OptimizeTrans, 27 | RemoveDups, 28 | RemoveZero, 29 | Composite, 30 | Merge, 31 | Flatten, 32 | Mosaic, 33 | Trimbounds, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Core/Script/MagickScript.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NETSTANDARD1_3 14 | 15 | using System.Xml; 16 | 17 | namespace ImageMagick 18 | { 19 | /// 20 | /// Contains code that is not compatible with .NET Framework. 21 | /// 22 | public sealed partial class MagickScript 23 | { 24 | private static XmlReaderSettings CreateXmlReaderSettings() => new XmlReaderSettings() 25 | { 26 | IgnoreComments = true, 27 | IgnoreWhitespace = true, 28 | }; 29 | } 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Core/Extensions/MemoryStreamExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NETSTANDARD1_3 14 | 15 | using System; 16 | using System.IO; 17 | 18 | namespace ImageMagick 19 | { 20 | internal static class MemoryStreamExtensions 21 | { 22 | internal static byte[] GetBuffer(this MemoryStream memStream) 23 | { 24 | ArraySegment buffer; 25 | if (!memStream.TryGetBuffer(out buffer)) 26 | return memStream.ToArray(); 27 | 28 | return buffer.Array; 29 | } 30 | } 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/SeekExceptionStream.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.IO; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | [ExcludeFromCodeCoverage] 19 | internal sealed class SeekExceptionStream : TestStream 20 | { 21 | public SeekExceptionStream(Stream innerStream) 22 | : base(innerStream, true) 23 | { 24 | } 25 | 26 | public override long Seek(long offset, SeekOrigin origin) 27 | { 28 | throw new InvalidOperationException(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | "settings": 4 | { 5 | "documentationRules": 6 | { 7 | "documentInternalElements": false, 8 | "xmlHeader": false, 9 | "copyrightText": "Copyright 2013-2020 Dirk Lemstra \n\nLicensed under the ImageMagick License (the \"License\"); you may not use this file except in\ncompliance with the License. You may obtain a copy of the License at\n\n https://www.imagemagick.org/script/license.php\n\nUnless required by applicable law or agreed to in writing, software distributed under the\nLicense is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\neither express or implied. See the License for the specific language governing permissions\nand limitations under the License." 10 | }, 11 | "indentation": 12 | { 13 | "indentationSize": 4 14 | }, 15 | "orderingRules": 16 | { 17 | "usingDirectivesPlacement": "outsideNamespace" 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/ReadExceptionStream.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.IO; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | [ExcludeFromCodeCoverage] 19 | internal sealed class ReadExceptionStream : TestStream 20 | { 21 | public ReadExceptionStream(Stream innerStream) 22 | : base(innerStream, true) 23 | { 24 | } 25 | 26 | public override int Read(byte[] buffer, int offset, int count) 27 | { 28 | throw new InvalidOperationException(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Magick.NET/Framework/BitmapDensity.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if !NETSTANDARD 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Bitmap density options. 19 | /// 20 | public enum BitmapDensity 21 | { 22 | /// 23 | /// Ignore the density of the image when creating the bitmap. 24 | /// 25 | Ignore, 26 | 27 | /// 28 | /// Use the density of the image when creating the bitmap. 29 | /// 30 | Use, 31 | } 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Helpers/FileHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.IO; 14 | 15 | namespace ImageMagick 16 | { 17 | internal static partial class FileHelper 18 | { 19 | public static string GetFullPath(string path) 20 | { 21 | Throw.IfNullOrEmpty(nameof(path), path); 22 | 23 | path = CheckForBaseDirectory(path); 24 | path = Path.GetFullPath(path); 25 | Throw.IfFalse(nameof(path), Directory.Exists(path), $"Unable to find directory: {path}"); 26 | return path; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/8Bim/IClipPath.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Xml.XPath; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// A value of the exif profile. 19 | /// 20 | public interface IClipPath 21 | { 22 | /// 23 | /// Gets the name of the clipping path. 24 | /// 25 | string Name { get; } 26 | 27 | /// 28 | /// Gets the path of the clipping path. 29 | /// 30 | IXPathNavigable Path { get; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifSignedRationalArray.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal sealed class ExifSignedRationalArray : ExifArrayValue 16 | { 17 | public ExifSignedRationalArray(ExifTag tag) 18 | : base(tag) 19 | { 20 | } 21 | 22 | public ExifSignedRationalArray(ExifTagValue tag) 23 | : base(tag) 24 | { 25 | } 26 | 27 | public override ExifDataType DataType => ExifDataType.SignedRational; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/WriteExceptionStream.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.IO; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | [ExcludeFromCodeCoverage] 19 | internal sealed class WriteExceptionStream : TestStream 20 | { 21 | public WriteExceptionStream(Stream innerStream) 22 | : base(innerStream, true) 23 | { 24 | } 25 | 26 | public override void Write(byte[] buffer, int offset, int count) 27 | { 28 | throw new InvalidOperationException(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Drawables/DrawablePathTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Linq; 14 | using ImageMagick; 15 | using Microsoft.VisualStudio.TestTools.UnitTesting; 16 | 17 | namespace Magick.NET.Tests 18 | { 19 | [TestClass] 20 | public class DrawablePathTests 21 | { 22 | [TestMethod] 23 | public void Test_DrawablePath() 24 | { 25 | DrawablePath path = new DrawablePath(); 26 | Assert.AreEqual(0, path.Paths.Count()); 27 | 28 | ((IDrawingWand)path).Draw(null); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Extensions/INativeInstanceExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using ImageMagick; 15 | using Microsoft.VisualStudio.TestTools.UnitTesting; 16 | 17 | namespace Magick.NET.Tests 18 | { 19 | [TestClass] 20 | public class INativeInstanceExtensionsTests 21 | { 22 | [TestMethod] 23 | public void GetInstance_ValueIsNull_ReturnsIntPtrZero() 24 | { 25 | INativeInstance instance = null; 26 | Assert.AreEqual(IntPtr.Zero, instance.GetInstance()); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Configuration/IConfigurationFile.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Configuration 14 | { 15 | /// 16 | /// Interface that represents a configuration file. 17 | /// 18 | public interface IConfigurationFile 19 | { 20 | /// 21 | /// Gets the file name. 22 | /// 23 | string FileName { get; } 24 | 25 | /// 26 | /// Gets or sets the data of the configuration file. 27 | /// 28 | string Data { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/TextDirection.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specified the direction for text. 17 | /// 18 | public enum TextDirection 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// RightToLeft 27 | /// 28 | RightToLeft, 29 | 30 | /// 31 | /// LeftToRight 32 | /// 33 | LeftToRight, 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Tags/ExifTag{TValueType}.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Class that represents an exif tag from the Exif standard 2.31 with as the data type of the tag. 17 | /// 18 | /// The data type of the tag. 19 | public sealed class ExifTag : ExifTag 20 | { 21 | internal ExifTag(ExifTagValue value) 22 | : base((ushort)value) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/DensityUnit.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Units of image resolution. 17 | /// 18 | public enum DensityUnit 19 | { 20 | /// 21 | /// Undefied 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Pixels per inch 27 | /// 28 | PixelsPerInch, 29 | 30 | /// 31 | /// Pixels per centimeter 32 | /// 33 | PixelsPerCentimeter, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Formats/Tiff/TiffAlpha.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Formats.Tiff 14 | { 15 | /// 16 | /// Specifies tiff alpha options. 17 | /// 18 | public enum TiffAlpha 19 | { 20 | /// 21 | /// Unspecified 22 | /// 23 | Unspecified, 24 | 25 | /// 26 | /// Associated 27 | /// 28 | Associated, 29 | 30 | /// 31 | /// Unassociated 32 | /// 33 | Unassociated, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET.ruleset: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/TellExceptionStream.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.IO; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | [ExcludeFromCodeCoverage] 19 | internal sealed class TellExceptionStream : TestStream 20 | { 21 | public TellExceptionStream(Stream innerStream) 22 | : base(innerStream, true) 23 | { 24 | } 25 | 26 | public override long Position 27 | { 28 | get => throw new InvalidOperationException(); 29 | set => base.Position = value; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Helpers/TestImageProfile.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick; 14 | 15 | namespace Magick.NET 16 | { 17 | public sealed class TestImageProfile : IImageProfile 18 | { 19 | private readonly byte[] _bytes; 20 | 21 | public TestImageProfile(string name, byte[] bytes) 22 | { 23 | Name = name; 24 | _bytes = bytes; 25 | } 26 | 27 | public string Name { get; } 28 | 29 | public bool Equals(IImageProfile other) => false; 30 | 31 | public byte[] ToByteArray() => _bytes; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/GifOptimizerTests/TheOptimalCompressionProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using Microsoft.VisualStudio.TestTools.UnitTesting; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class GifOptimizerTests 18 | { 19 | [TestClass] 20 | public class TheOptimalCompressionProperty : GifOptimizerTests 21 | { 22 | [TestMethod] 23 | public void ShouldReturnFalse() 24 | { 25 | Assert.IsFalse(Optimizer.OptimalCompression); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/IcoOptimizerTests/TheOptimalCompressionProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using Microsoft.VisualStudio.TestTools.UnitTesting; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class IcoOptimizerTests 18 | { 19 | [TestClass] 20 | public class TheOptimalCompressionProperty : IcoOptimizerTests 21 | { 22 | [TestMethod] 23 | public void ShouldReturnFalse() 24 | { 25 | Assert.IsFalse(Optimizer.OptimalCompression); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/PngOptimizerTests/TheOptimalCompressionProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using Microsoft.VisualStudio.TestTools.UnitTesting; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class PngOptimizerTests 18 | { 19 | [TestClass] 20 | public class TheOptimalCompressionProperty : PngOptimizerTests 21 | { 22 | [TestMethod] 23 | public void ShouldReturnFalse() 24 | { 25 | Assert.IsFalse(Optimizer.OptimalCompression); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Types/PointInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | internal partial class PointInfo 18 | { 19 | private PointInfo(IntPtr instance) 20 | { 21 | NativePointInfo nativeInstance = new NativePointInfo(instance); 22 | X = nativeInstance.X; 23 | Y = nativeInstance.Y; 24 | } 25 | 26 | public double X { get; } 27 | 28 | public double Y { get; } 29 | 30 | public static PointInfo CreateInstance(IntPtr instance) => new PointInfo(instance); 31 | } 32 | } -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Optimizers/JpegOptimizerTests/TheOptimalCompressionProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using Microsoft.VisualStudio.TestTools.UnitTesting; 14 | 15 | namespace Magick.NET.Tests 16 | { 17 | public partial class JpegOptimizerTests 18 | { 19 | [TestClass] 20 | public class TheOptimalCompressionProperty : JpegOptimizerTests 21 | { 22 | [TestMethod] 23 | public void ShouldReturnFalse() 24 | { 25 | Assert.IsFalse(Optimizer.OptimalCompression); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Magick.NET/Native/Colors/MagickColor.json: -------------------------------------------------------------------------------- 1 | { 2 | "dynamic": "Both", 3 | "properties": [ 4 | { 5 | "name": "Count", 6 | "type": "ulong", 7 | "readonly": true 8 | }, 9 | { 10 | "name": "Red", 11 | "type": "QuantumType" 12 | }, 13 | { 14 | "name": "Green", 15 | "type": "QuantumType" 16 | }, 17 | { 18 | "name": "Blue", 19 | "type": "QuantumType" 20 | }, 21 | { 22 | "name": "Alpha", 23 | "type": "QuantumType" 24 | }, 25 | { 26 | "name": "Black", 27 | "type": "QuantumType" 28 | }, 29 | { 30 | "name": "IsCMYK", 31 | "type": "bool" 32 | } 33 | ], 34 | "methods": [ 35 | { 36 | "name": "FuzzyEquals", 37 | "type": "bool", 38 | "arguments": [ 39 | { 40 | "name": "other", 41 | "type": "MagickColor" 42 | }, 43 | { 44 | "name": "fuzz", 45 | "type": "QuantumType" 46 | } 47 | ] 48 | }, 49 | { 50 | "name": "Initialize", 51 | "type": "bool", 52 | "arguments": [ 53 | { 54 | "name": "value", 55 | "type": "string" 56 | } 57 | ] 58 | } 59 | ] 60 | } 61 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Types/OffsetInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | internal partial class OffsetInfo 16 | { 17 | public OffsetInfo(int x, int y) 18 | { 19 | X = x; 20 | Y = y; 21 | } 22 | 23 | public int X { get; } 24 | 25 | public int Y { get; } 26 | 27 | public INativeInstance CreateNativeInstance() 28 | { 29 | var offsetInfo = new NativeOffsetInfo(); 30 | offsetInfo.SetX(X); 31 | offsetInfo.SetY(Y); 32 | return offsetInfo; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /docs/ExifData.md: -------------------------------------------------------------------------------- 1 | # Exif data 2 | 3 | ## Read exif data 4 | 5 | ```C# 6 | // Read image from file 7 | using (var image = new MagickImage("FujiFilmFinePixS1Pro.jpg")) 8 | { 9 | // Retrieve the exif information 10 | var profile = image.GetExifProfile(); 11 | 12 | // Check if image contains an exif profile 13 | if (profile == null) 14 | Console.WriteLine("Image does not contain exif information."); 15 | else 16 | { 17 | // Write all values to the console 18 | foreach (IExifValue value in profile.Values) 19 | { 20 | Console.WriteLine("{0}({1}): {2}", value.Tag, value.DataType, value.ToString()); 21 | } 22 | } 23 | } 24 | ``` 25 | 26 | ## Create thumbnail from exif data 27 | 28 | ```C# 29 | // Read image from file 30 | using (var image = new MagickImage("FujiFilmFinePixS1Pro.jpg")) 31 | { 32 | // Retrieve the exif information 33 | var profile = image.GetExifProfile(); 34 | 35 | // Create thumbnail from exif information 36 | using (var thumbnail = profile.CreateThumbnail()) 37 | { 38 | // Check if exif profile contains thumbnail and save it 39 | if (thumbnail != null) 40 | thumbnail.Write("FujiFilmFinePixS1Pro.thumb.jpg"); 41 | } 42 | } 43 | ``` -------------------------------------------------------------------------------- /src/Magick.NET/Framework/Helpers/FileHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if !NETSTANDARD 14 | 15 | using System; 16 | 17 | namespace ImageMagick 18 | { 19 | internal static partial class FileHelper 20 | { 21 | public static string CheckForBaseDirectory(string fileName) 22 | { 23 | if (string.IsNullOrEmpty(fileName)) 24 | return fileName; 25 | 26 | if (fileName.Length < 2 || fileName[0] != '~') 27 | return fileName; 28 | 29 | return AppDomain.CurrentDomain.BaseDirectory + fileName.Substring(1); 30 | } 31 | } 32 | } 33 | 34 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/LineCap.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies line cap. 17 | /// 18 | public enum LineCap 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Butt 27 | /// 28 | Butt, 29 | 30 | /// 31 | /// Round 32 | /// 33 | Round, 34 | 35 | /// 36 | /// Square 37 | /// 38 | Square, 39 | } 40 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/LineJoin.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies line join. 17 | /// 18 | public enum LineJoin 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Miter 27 | /// 28 | Miter, 29 | 30 | /// 31 | /// Round 32 | /// 33 | Round, 34 | 35 | /// 36 | /// Bevel 37 | /// 38 | Bevel, 39 | } 40 | } -------------------------------------------------------------------------------- /src/Magick.NET/Framework/Helpers/XmlHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if !NETSTANDARD 14 | 15 | using System.Xml; 16 | 17 | namespace ImageMagick 18 | { 19 | internal static partial class XmlHelper 20 | { 21 | public static XmlReaderSettings CreateReaderSettings() => new XmlReaderSettings() 22 | { 23 | #if !NET20 24 | DtdProcessing = DtdProcessing.Ignore, 25 | #endif 26 | XmlResolver = null, 27 | }; 28 | 29 | public static XmlDocument CreateDocument() => new XmlDocument() 30 | { 31 | XmlResolver = null, 32 | }; 33 | } 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/Magick.NET/Properties/InternalsVisibleTo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Runtime.CompilerServices; 14 | 15 | #if WINDOWS_BUILD 16 | [assembly: InternalsVisibleTo("Magick.NET.Tests, PublicKey=" + 17 | "002400000480000094000000060200000024000052534131000400000100010041848921d7f5c3" + 18 | "fdd251ba0d5e4e18a23ad2c73239a163cfc0f3aabe0b1d3e0bb69a9c6ce8a83b3c9351f1287e42" + 19 | "09fd8b3d7426b848b9715b219fcc28cc63a482a5678ee182d194b5a8f70ebbf65c3624b9920cb2" + 20 | "c483b3f7c428b95b53eeb144e348120377ccb686359114a90273b271ea351835b347b3e38a30d1" + 21 | "b44945a7")] 22 | #else 23 | [assembly: InternalsVisibleTo("Magick.NET.Tests")] 24 | #endif -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Framework/Colors/ColorRGBTests/TheConstructor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if !NETCORE 14 | 15 | using System.Drawing; 16 | using ImageMagick; 17 | using Microsoft.VisualStudio.TestTools.UnitTesting; 18 | 19 | namespace Magick.NET.Tests 20 | { 21 | public partial class ColorRGBTests : ColorBaseTests 22 | { 23 | [TestMethod] 24 | public void ShouldCreateCorrectColorWhenUsingSystemDrawingColor() 25 | { 26 | ColorRGB fuchsia = new ColorRGB(Color.Fuchsia); 27 | 28 | ColorAssert.AreEqual(fuchsia, MagickColors.Fuchsia); 29 | } 30 | } 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Formats/Psd/PsdAdditionalInfoPart.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Formats.Psd 14 | { 15 | /// 16 | /// Specifies which additional info should be written to the output file. 17 | /// 18 | public enum PsdAdditionalInfoPart 19 | { 20 | /// 21 | /// None 22 | /// 23 | None, 24 | 25 | /// 26 | /// All 27 | /// 28 | All, 29 | 30 | /// 31 | /// Only select the info that does not use geometry. 32 | /// 33 | Selective, 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/Exif/Values/ExifRational.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Globalization; 14 | 15 | namespace ImageMagick 16 | { 17 | internal sealed class ExifRational : ExifValue 18 | { 19 | public ExifRational(ExifTag tag) 20 | : base(tag) 21 | { 22 | } 23 | 24 | public ExifRational(ExifTagValue tag) 25 | : base(tag) 26 | { 27 | } 28 | 29 | public override ExifDataType DataType => ExifDataType.Rational; 30 | 31 | protected override string StringValue => Value.ToString(CultureInfo.InvariantCulture); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Magick.Native/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | version=$( 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.IO; 14 | using ImageMagick; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | public partial class TiffWriteDefinesTests 19 | { 20 | private static IMagickImage WriteTiff(IMagickImage image) 21 | { 22 | using (var memStream = new MemoryStream()) 23 | { 24 | image.Format = MagickFormat.Tiff; 25 | image.Write(memStream); 26 | memStream.Position = 0; 27 | return new MagickImage(memStream); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Defines/IDefine.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Interface for a define. 17 | /// 18 | public interface IDefine 19 | { 20 | /// 21 | /// Gets the format to set the define for. 22 | /// 23 | MagickFormat Format { get; } 24 | 25 | /// 26 | /// Gets the name of the define. 27 | /// 28 | string Name { get; } 29 | 30 | /// 31 | /// Gets the value of the define. 32 | /// 33 | string Value { get; } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Defines/ReadDefinesCreator.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Defines 14 | { 15 | /// 16 | /// Base class that can create read defines. 17 | /// 18 | public abstract class ReadDefinesCreator : DefinesCreator, IReadDefines 19 | { 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The format where the defines are for. 24 | protected ReadDefinesCreator(MagickFormat format) 25 | : base(format) 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Magick.NET/Framework/Colors/ColorRGB.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if !NETSTANDARD 14 | 15 | using System.Drawing; 16 | 17 | namespace ImageMagick 18 | { 19 | /// 20 | /// Contains code that is not compatible with .NET Core. 21 | /// 22 | public sealed partial class ColorRGB 23 | { 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The color to use. 28 | public ColorRGB(Color color) 29 | : base(new MagickColor(color)) 30 | { 31 | } 32 | } 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Types/StringInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | internal partial class StringInfo 18 | { 19 | public byte[] Datum { get; private set; } 20 | 21 | public static StringInfo CreateInstance(IntPtr instance) 22 | { 23 | if (instance == IntPtr.Zero) 24 | return null; 25 | 26 | NativeStringInfo native = new NativeStringInfo(instance); 27 | 28 | return new StringInfo 29 | { 30 | Datum = ByteConverter.ToArray(native.Datum, native.Length), 31 | }; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/DitherMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies dither methods. 17 | /// 18 | public enum DitherMethod 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// No 27 | /// 28 | No, 29 | 30 | /// 31 | /// Riemersma 32 | /// 33 | Riemersma, 34 | 35 | /// 36 | /// FloydSteinberg 37 | /// 38 | FloydSteinberg, 39 | } 40 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/TextAlignment.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specified the type of text alignment. 17 | /// 18 | public enum TextAlignment 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Left 27 | /// 28 | Left, 29 | 30 | /// 31 | /// Center 32 | /// 33 | Center, 34 | 35 | /// 36 | /// Right 37 | /// 38 | Right, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Formats/Bmp/BmpSubtype.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick.Formats.Bmp 14 | { 15 | /// 16 | /// Specifies bmp subtypes. 17 | /// 18 | public enum BmpSubtype 19 | { 20 | /// 21 | /// ARGB1555 22 | /// 23 | ARGB1555, 24 | 25 | /// 26 | /// ARGB4444 27 | /// 28 | ARGB4444, 29 | 30 | /// 31 | /// RGB555 32 | /// 33 | RGB555, 34 | 35 | /// 36 | /// RGB565 37 | /// 38 | RGB565, 39 | } 40 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/IImageProfile.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Interface that describes an image profile. 19 | /// 20 | public interface IImageProfile : IEquatable 21 | { 22 | /// 23 | /// Gets the name of the profile. 24 | /// 25 | string Name { get; } 26 | 27 | /// 28 | /// Converts this instance to a byte array. 29 | /// 30 | /// A array. 31 | byte[] ToByteArray(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/GifDisposeMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies gif disposal methods. 17 | /// 18 | public enum GifDisposeMethod 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// None 27 | /// 28 | None, 29 | 30 | /// 31 | /// Background 32 | /// 33 | Background, 34 | 35 | /// 36 | /// Previous 37 | /// 38 | Previous, 39 | } 40 | } -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Profiles/8Bim/IEightBimProfile.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System.Collections.Generic; 14 | 15 | namespace ImageMagick 16 | { 17 | /// 18 | /// Interface that describes an 8bim profile. 19 | /// 20 | public interface IEightBimProfile : IImageProfile 21 | { 22 | /// 23 | /// Gets the clipping paths this image contains. 24 | /// 25 | IEnumerable ClipPaths { get; } 26 | 27 | /// 28 | /// Gets the values of this 8bim profile. 29 | /// 30 | IEnumerable Values { get; } 31 | } 32 | } -------------------------------------------------------------------------------- /tools/FileGenerators/Native/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.Reflection; 15 | using System.Runtime.InteropServices; 16 | 17 | [assembly: AssemblyTitle("FileGenerator.Native")] 18 | [assembly: AssemblyProduct("Magick.NET")] 19 | [assembly: AssemblyDescription("FileGenerator.Native")] 20 | [assembly: AssemblyCompany("")] 21 | [assembly: AssemblyCopyright("Copyright © 2013-2020 Dirk Lemstra")] 22 | [assembly: AssemblyTrademark("")] 23 | 24 | [assembly: AssemblyConfiguration("Release")] 25 | [assembly: AssemblyCulture("")] 26 | [assembly: AssemblyVersion("7.0.0.0")] 27 | [assembly: ComVisible(false)] 28 | [assembly: CLSCompliant(true)] -------------------------------------------------------------------------------- /tools/FileGenerators/Shared/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.Reflection; 15 | using System.Runtime.InteropServices; 16 | 17 | [assembly: AssemblyTitle("FileGenerator.Shared")] 18 | [assembly: AssemblyProduct("Magick.NET")] 19 | [assembly: AssemblyDescription("FileGenerator.Shared")] 20 | [assembly: AssemblyCompany("")] 21 | [assembly: AssemblyCopyright("Copyright © 2013-2020 Dirk Lemstra")] 22 | [assembly: AssemblyTrademark("")] 23 | 24 | [assembly: AssemblyConfiguration("Release")] 25 | [assembly: AssemblyCulture("")] 26 | [assembly: AssemblyVersion("7.0.0.0")] 27 | [assembly: ComVisible(false)] 28 | [assembly: CLSCompliant(true)] -------------------------------------------------------------------------------- /src/Magick.NET/Core/Helpers/XmlHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if NETSTANDARD 14 | 15 | using System.Xml; 16 | 17 | namespace ImageMagick 18 | { 19 | internal static partial class XmlHelper 20 | { 21 | public static XmlReaderSettings CreateReaderSettings() => new XmlReaderSettings() 22 | { 23 | DtdProcessing = DtdProcessing.Ignore, 24 | #if !NETSTANDARD1_3 25 | XmlResolver = null, 26 | #endif 27 | }; 28 | 29 | public static XmlDocument CreateDocument() => new XmlDocument() 30 | { 31 | #if !NETSTANDARD1_3 32 | XmlResolver = null, 33 | #endif 34 | }; 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Enums/AutoThresholdMethod.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Specifies the auto threshold methods. 17 | /// 18 | public enum AutoThresholdMethod 19 | { 20 | /// 21 | /// Undefined 22 | /// 23 | Undefined, 24 | 25 | /// 26 | /// Kapur 27 | /// 28 | Kapur, 29 | 30 | /// 31 | /// OTSU 32 | /// 33 | OTSU, 34 | 35 | /// 36 | /// Triangle 37 | /// 38 | Triangle, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Exceptions/Error/MagickErrorException.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Encapsulation of the ImageMagick Error exception. 17 | /// 18 | public class MagickErrorException : MagickException 19 | { 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The error message that explains the reason for the exception. 24 | internal MagickErrorException(string message) 25 | : base(message) 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tools/FileGenerators/Drawables/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.Reflection; 15 | using System.Runtime.InteropServices; 16 | 17 | [assembly: AssemblyTitle("FileGenerator.Drawables")] 18 | [assembly: AssemblyProduct("Magick.NET")] 19 | [assembly: AssemblyDescription("FileGenerator.Drawables")] 20 | [assembly: AssemblyCompany("")] 21 | [assembly: AssemblyCopyright("Copyright © 2013-2020 Dirk Lemstra")] 22 | [assembly: AssemblyTrademark("")] 23 | 24 | [assembly: AssemblyConfiguration("Release")] 25 | [assembly: AssemblyCulture("")] 26 | [assembly: AssemblyVersion("7.0.0.0")] 27 | [assembly: ComVisible(false)] 28 | [assembly: CLSCompliant(true)] -------------------------------------------------------------------------------- /tools/FileGenerators/Shared/Extensions/IEnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | using System.Collections.Generic; 15 | 16 | namespace FileGenerator 17 | { 18 | public static class IEnumerableExtensions 19 | { 20 | public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector) 21 | { 22 | HashSet seenKeys = new HashSet(); 23 | foreach (TSource element in source) 24 | { 25 | if (seenKeys.Add(keySelector(element))) 26 | yield return element; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Windows/OpenCL/OpenCLTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | #if WINDOWS_BUILD 14 | 15 | using ImageMagick; 16 | using Microsoft.VisualStudio.TestTools.UnitTesting; 17 | 18 | namespace Magick.NET.Tests 19 | { 20 | [TestClass] 21 | public partial class OpenCLTests 22 | { 23 | [TestMethod] 24 | public void Test_IsEnabled() 25 | { 26 | Assert.AreEqual(OpenCL.IsEnabled, true); 27 | 28 | OpenCL.IsEnabled = false; 29 | Assert.AreEqual(OpenCL.IsEnabled, false); 30 | 31 | OpenCL.IsEnabled = true; 32 | Assert.AreEqual(OpenCL.IsEnabled, true); 33 | } 34 | } 35 | } 36 | 37 | #endif -------------------------------------------------------------------------------- /tools/FileGenerators/Drawables/AppDomain/DrawableApplicationProxy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using System; 14 | 15 | namespace FileGenerator.Drawables 16 | { 17 | internal sealed class DrawableApplicationProxy : ApplicationProxy 18 | { 19 | public void GenerateDrawables() 20 | { 21 | AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += ResolveAssembly; 22 | 23 | DrawablesGenerator.Generate(); 24 | } 25 | 26 | public void GeneratePaths() 27 | { 28 | AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += ResolveAssembly; 29 | 30 | PathsGenerator.Generate(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Magick.NET/Shared/Exceptions/Warning/MagickWarningException.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | namespace ImageMagick 14 | { 15 | /// 16 | /// Encapsulation of the ImageMagick Warning exception. 17 | /// 18 | public class MagickWarningException : MagickException 19 | { 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The error message that explains the reason for the exception. 24 | internal MagickWarningException(string message) 25 | : base(message) 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/QuantumTests/TheDepthProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick; 14 | using Microsoft.VisualStudio.TestTools.UnitTesting; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | public partial class QuantumTests 19 | { 20 | [TestClass] 21 | public class TheDepthProperty 22 | { 23 | [TestMethod] 24 | public void ShouldHaveTheCorrectValue() 25 | { 26 | #if Q8 27 | Assert.AreEqual(Quantum.Depth, 8); 28 | #elif Q16 || Q16HDRI 29 | Assert.AreEqual(Quantum.Depth, 16); 30 | #else 31 | #error Not implemented! 32 | #endif 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Magick.NET.Tests/Shared/Settings/MagickSettingsTests/TheVerboseProperty.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2020 Dirk Lemstra 2 | // 3 | // Licensed under the ImageMagick License (the "License"); you may not use this file except in 4 | // compliance with the License. You may obtain a copy of the License at 5 | // 6 | // https://www.imagemagick.org/script/license.php 7 | // 8 | // Unless required by applicable law or agreed to in writing, software distributed under the 9 | // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | // either express or implied. See the License for the specific language governing permissions 11 | // and limitations under the License. 12 | 13 | using ImageMagick; 14 | using Microsoft.VisualStudio.TestTools.UnitTesting; 15 | 16 | namespace Magick.NET.Tests 17 | { 18 | public partial class MagickSettingsTests 19 | { 20 | [TestClass] 21 | public class TheVerboseProperty 22 | { 23 | [TestMethod] 24 | public void ShouldDefaultToFalse() 25 | { 26 | using (IMagickImage image = new MagickImage()) 27 | { 28 | Assert.IsFalse(image.Settings.Verbose); 29 | } 30 | } 31 | } 32 | } 33 | } 34 | --------------------------------------------------------------------------------