This project has moved and is read-only. For the latest updates, please go here.

Resizing Images In Folder

Mar 30, 2016 at 11:42 PM
Hi, I recently found this project and familiar with ImageMagick so I thought I gave this a try. I'm relatively new to C#. I just want to do something really simple, resize all images in a folder and save them in another directory. Would the following code do what I want?
                string imgFolderTXT = txtImgFolder.Text;
                //imgFolderTXT = (@"C:\Users\Desktop\ImgFolder");
                using (MagickImageCollection collection = new MagickImageCollection(imgFolderTXT))
                foreach (MagickImage image in collection)
                        image.Resize(300, 300);
I haven't been able to try it as of yet because upon running I get this error code of which I found some similar questions on this discussion but I believe I have all the dependencies setup properly.
Additional information: Could not load file or assembly 'Magick.NET-Q8-x64, Version=, Culture=neutral, PublicKeyToken=2004825badfa91ec' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Any advice is greatly appreciated!
Mar 31, 2016 at 9:40 PM
It looks like you are trying to load an 64-bit dll in a 32-bit process. Not sure why that is happening, I remember that there was an issue with IIS express. Are you using that?

The MagickImageCollection class is for an image that has multiple frames (e.g. GIF/PSD). You will need to get all the file names from the directory and read them with a MagickImage or a MagickImageCollection.