terjetyl / Simple.ImageResizer

A simple c# image resizer with ScaleToFit and ScaleToFill using wpf libraries. Resizes to jpg, gif, png, tiff. Demosite is hosted at AppHarbor: http://imageresizer.apphb.com/
58 stars 27 forks source link

The mysterious exception "operation completed successfully"... #9

Open rodrigopires opened 9 years ago

rodrigopires commented 9 years ago

My code:

private byte[] TransformImage(byte[] image, int width) {
    if (width <= 0)
        return image;

    ImageEncoding imgEncoding = ImageEncoding.Jpg;
    ImageResizer resizer = new ImageResizer(image);
    if (width > 1000) {
        imgEncoding = ImageEncoding.Jpg100;
    }
    return resizer.Resize(width, width, false, imgEncoding);
}

The strange exception:

Type: System.ComponentModel.Win32Exception Message: The operation completed successfully

:eyes:

Stack trace (partial):

System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d) at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks) at System.Windows.Threading.Dispatcher..ctor() at System.Windows.Threading.Dispatcher.get_CurrentDispatcher() at System.Windows.DependencyObject..ctor() at System.Windows.Media.Imaging.BitmapSource..ctor(Boolean useVirtuals) at Simple.ImageResizer.ImageResizer.LoadBitmapImage(Byte[] bytes)

But... as the message suggests, the image is rendered properly.

Anyone have any idea of what's going on? Why this error is being throwed?

Tks!

rodrigopires commented 9 years ago

A few other points:

Tks.