$ 0 0 You could use NagickImageInfo te detect the actual format of the file. This will determine the format without loading the pixels. Are you using the ImageOptimizer class or the JpegOptimizer?