Click here to Skip to main content
16,006,001 members
Please Sign up or sign in to vote.
1.36/5 (4 votes)
See more:
HI,

I'm trying to resize an image with ImageMagick ( third program) in c#
however the command

// use ImageMagick to resize images
var image = new ImageMagickObject.MagickImage(NewName);

List<object> convertParams = new List<object>();
image.resize("%50"); //---> does not work ( resize is not recognized)
Posted
Comments
ZurdoDev 25-Jun-15 8:10am    
I doubt %50 would work, did you try 50%?
Sergey Alexandrovich Kryukov 25-Jun-15 12:15pm    
Let me ask you: what did you find in ImageMagic which cannot be done with just System.Drawing?
—SA

That's because the MagickImage doesn't have a method called resize. It has a method called Convert, which accepts an array of arguments describing what you want to do. The available options documented on the ImageMagick site[^].

For example:
C#
var image = new ImageMagickObject.MagickImage();
image.Convert("InputImage.jpg", "-resize", "50%", "OutputImage.jpg");
 
Share this answer
 
Comments
ZurdoDev 25-Jun-15 9:53am    
It actually does have a Resize method, http://magick.codeplex.com/wikipage?title=Resize%20image&referringTitle=Documentation
Richard Deeming 25-Jun-15 9:59am    
That doesn't look like the same code that the OP's using - the namespace for the .NET wrapper is ImageMagick, but the question has ImageMagickObject. As far as I can see, that's from an older COM wrapper[^].

Having said that, the .NET wrapper looks like the right way to go. :)
ZurdoDev 25-Jun-15 10:02am    
Ah, could be.
According to this document, http://magick.codeplex.com/wikipage?title=Resize%20image&referringTitle=Documentation[^] the method is Resize, capital R, not lower case r. Also, as in comments, I doubt %50 would work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900