Quantcast
Channel: magick Discussions Rss Feed
Viewing all 3693 articles
Browse latest View live

New Post: Magick.NET and Mono

$
0
0
A GraphicsMagick library exists for Node.js which wraps the executable in a fluent interface: http://aheckmann.github.io/gm/. Maybe that idea could be ported to .NET to make a multiplatform library :)

Could you potentially use P/Invoke instead of a mixed mode assembly? Mono does support P/Invoke.

New Post: Magick.NET and Mono

$
0
0
I don't really want to switch to P/Invoke or wrap the executable because I am quite happy that everything is now included in one library that only depends on the C++ redistributable library. If I ever create a Mono version of Magick.NET I will probably have to generate a different set of ImageMagick header files that do a P/Invoke. But as I said earlier I first need to find some extra time :)

New Post: Magick.NET and Mono

$
0
0
That's fair enough, having it all as one library makes it easy to use :)

For what it's worth, here's the solution I came up with for resizing images using GraphicsMagick, which works on both MS.NET and Mono. I'm using GraphicsMagick to work around the horrible quality of resized images in Mono. Mono's GDI+/System.Drawing implementation uses Cairo which just does a bilinear resize with no nicer interpolation options.
/// <summary>
/// Generates a thumbnail for the specified image, using ImageMagick or GraphicsMagick
/// </summary>
/// <param name="sourceImg">Image to generate thumbnail for</param>
/// <param name="width">Width of the thumbnail</param>
/// <param name="height">Height of the thumbnail</param>
/// <returns>Thumbnail image</returns>
public static Bitmap GenerateMagickThumbnail(this Image sourceImg, int width, int height)
{
    // Create new GraphicsMagick process for thumbnail generation
    var process = new Process
    {
        StartInfo = new ProcessStartInfo
        {
            FileName = "gm",
            Arguments = string.Format("convert - -filter sinc -size {0}x{1} -resize {0}x{1} -", width, height),
            RedirectStandardInput = true,
            RedirectStandardOutput = true,
            RedirectStandardError = true,
            UseShellExecute = false,
            CreateNoWindow = true,
        }
    };

    process.Start();

    // Write source image to input stream of GraphicsMagick
    sourceImg.Save(process.StandardInput.BaseStream, ImageFormat.Png);
    process.StandardInput.Flush();
    process.StandardInput.Close();

    try
    {
        var thumb = new Bitmap(process.StandardOutput.BaseStream);
        return thumb;
    }
    catch (Exception ex)
    {
        var errors = process.StandardError.ReadToEnd();
        throw new Exception(string.Format("Error invoking GraphicsMagick: {0}\nOriginal exception: {1}", errors, ex));
    }
    finally
    {
        process.Dispose();
    }
}

New Post: System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64'

$
0
0
i'm using windown server 2012 and add Magick.NET-x64 in class library visual 2008. I'm build gacutil.exe assembly use FTP : http://www.iis.net/learn/develop/developing-for-ftp/how-to-use-managed-code-c-to-create-an-ftp-provider-that-prevents-leeching . when upload success --> convert thumb image :
                using (MagickImage image = new MagickImage("C:\\images.eps"))
                {
                    image.Write("C:\\thumb.jpg");
                }
i'm installed Visual C++ Redistributable for Visual Studio 2008 . Waiting for your help

Thanks a lot

New Post: System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64'

$
0
0
I am sorry but your message is quite confusing. What do you mean by 'when upload success --> convert thumb image :'? Which version of Magick.NET are you using, are you using the .NET 2.0 version? And I don't understand what you are trying to tell me with the gacutil.exe / FTP article.

When you receive the message 'System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64' it means that your application cannot find the Magick.NET assembly. Did you upload it to your server?

New Post: System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64'

$
0
0
i'm using the .NET 2.0 version. And build asembly in class library . when I call Magick.NET through library -> System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64' . sorry for my english slightly worse.

New Post: Resize filter parameters

$
0
0
//  Magick.NET 6.8.6.801  .Net 4.0
void result(object z){ System.Diagnostics.Debug.WriteLine(String.Format("{0}", z ?? "null")); }

using (MagickImage img = new MagickImage(src))
{
String z;
z = "filename";             result(img.GetAttribute(z));
img.SetAttribute(z,"test"); result(img.GetAttribute(z));

z="filter:blur";            result(img.GetArtifact(z)); 
img.SetArtifact(z, "1.23"); result(img.GetArtifact(z)); 
}

result:
null
test
null
null
I tested it, but GetArtifact function() Result appearing not as expected.
What is a problem? ,thanks

New Post: Resize filter parameters

$
0
0
Thank you for finding that bug. The artifact is set but GetArtifact now returns the attribute instead of the artifact.

New Post: System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64'

$
0
0
Did you install Magick.NET-x64 in the GAC on your server? I don't have experience with installing assemblies in the global assembly cache but it looks like your application cannot find Magick.NET-x64 in the GAC. Maybe you should add the following to your web.config:
<system.web><compilation><assemblies><addassembly="Magick.NET-x64, Version=6.0.0.0"PublicKeyToken="2004825badfa91ec"/></assemblies></compilation></system.web>

New Post: System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64'

New Post: System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64'

$
0
0
Did you do the following on your server?
gacutil.exe /if "c:\folderwithyourfiles\Magick.NET-x64.dll"
gacutil.exe /if "c:\folderwithyourfiles\YourLibrary.dll"

New Post: Image Overlay

$
0
0
Hello,

I recently installed the Magick.NET library for an application I am developing for high throughput image screening.
one of the requirements is to be able to overlay multiple images (no more than 3). The original images are scanned in gray-scale 16bits channel so the first thing I do is convert them to 8bits, RGB mode image. Then each image needs to be colorized (either red, green or blue).
The last step is to overlay them (order is not important). However, I've been unsuccessful in doing so and I am hoping someone can help me.

This is what I tried so far:
MagickImage img1 = new MagickImage(filename1)
MagicImage img2 = new MagickImage(filename2);

//first attempt
MagickImageCollection col = new MagickImageCollection() {img1, img2};
col.Merge(); // caused the result image to be fully colorized 

// second attempt
MagickImageCollection col = new MagickImageCollection() {img1, img2};
col.Combine(); // the RGB colors were combined into the resulting color.

// third attempt
img1.Composite(img2, Gravirt.Center); // generated a mesh of RGB colors
I don't really have much image processing experience so I apologize in advance for not being able to use proper terminology. But what I am really trying to achieve here is to overlay the pixels of one image with the pixels of the other image.

I tried to upload images to show you what I mean by overlaying pixels but it doesn't seem to work.

I hope you can help me.
Thanks,

New Post: Image Overlay

$
0
0
Your third attempt was almost right. With the images you emailed me I was able to produce the expected result:
using (MagickImage first = new MagickImage("Source_img1.tif"))
{
  MagickImage second = new MagickImage("Source_img2.tif");
  
  first.Composite(second, 0, 0, CompositeOperator.Plus);
  
  first.Write("overlaid_img.tif");
}
You should specify the CompositeOperator. I think 'Plus' is the one you need but feel free to try the other composite operators.

New Post: image.Extent how to get transparent background

$
0
0
I am experimenting with Magick.NET, and am trying to get a transparent background. I can get this to work with code like the following, but I think this is a hack, and not the correct way to do this. What would be the correct way to accomplish this?
MagickImage image = new MagickImage(sPath + "Render3D1.jpg");
image.Resize(300, 300);
image.Format = MagickFormat.Png;
var geometry = new ImageMagick.MagickGeometry(300, 300);
var gravity = new ImageMagick.Gravity();
var backgroundColor = new ColorMono(false); //* Hack??
gravity = Gravity.Center;
image.Extent(geometry, gravity, backgroundColor);
image.Write(sPath + "Render3D1_300_WthGeometry.png");

New Post: Why not set background when convert SVG to PNG?

$
0
0
Hi all. I not set background when convert image from SVG to PNG? Why?
Thanhks.

New Post: image.Extent how to get transparent background

$
0
0
You actually found a bug, it's not a feature. It should be white instead of transparent. This will be fixed in the next release. You can do this:
using (MagickImage image = new MagickImage(sPath + "Render3D1.jpg")
{
  image.Resize(300, 300);
  image.Format = MagickFormat.Png;
  // There is an implicit cast from System.Drawing.Color to MagickColor.
  image.Extent(300, 300, Gravity.Center, System.Drawing.Color.Transparent);
  image.Write(sPath + "Render3D1_300_WthGeometry.png");
}
I will create a static property MagickColor.Transparent so you won't have to use System.Drawing.

New Post: Why not set background when convert SVG to PNG?

$
0
0
Can you please post some example code so I can see what you are trying to do? Are you using the build in SVG engine of ImageMagick or are you using something like InkScape as a delegate?

New Post: Image Overlay

$
0
0
Hi Again,

Thank you so much. It worked beautifully :)

Best,
rob

New Post: image.Extent how to get transparent background

$
0
0

Thank you. Your efforts are much appreciated. This is a great project you are doing!

Do you take donations anywhere?

Tom McEwen

AnchorCove Publishing, Inc.

www.anchorcovepublishing.com

[email removed]

Phone: 303-972-0099

New Post: image.Extent how to get transparent background

$
0
0

Thank you. Your efforts are much appreciated. This is a great project you are doing!

Do you take donations anywhere?

Tom McEwen

AnchorCove Publishing, Inc.

www.anchorcovepublishing.com

[email removed]

Phone: 303-972-0099

Viewing all 3693 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>