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

New Post: Can Magick.NET automatically identify image encoding?

$
0
0
I have files that are usually - but not always - in TGA format. They are named with a .1 extension.

Code like the below fails on the new MagickImage(f) call with a "no delegate" exception when f is, for example, "00001.1"

If I change the file name and value of f to "00001.tga" it works. Is there a way to get Magick.NET to identify the image format regardless of file name extension?
            using (MagickImage image = new MagickImage(f))
            {
                // Convert to .bmp
                image.Format = MagickFormat.Bmp;
                // Create byte array that contains image
                byte[] data = image.ToByteArray();
                File.WriteAllBytes(Path.Combine(ImageFolder, jFolder, s.Replace(".1", ".bmp")), data);
            }
Thanks!

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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