Bitmap GetWidth method gives wrong for jpg image.

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 334
Joined: Wed Jan 20, 2010 1:15 pm

Bitmap GetWidth method gives wrong for jpg image.

Post by dkaip »

Hello, in code bellow i have problem.. GetWidth gives wrong for jpg image.
Image is ok.
Thank you.
Jim.

ASSERT INFO:
../src/gtk/bitmap.cpp(924): assert "IsOk()" failed in GetWidth(): invalid bitmap

Code: Select all

wxInitAllImageHandlers();
wxFileName img("myimage.jpg");
wxBitmap bmp = wxBitmap(img.GetFullPath());
size_t dx=bmp.GetWidth();
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Bitmap GetWidth method gives wrong for jpg image.

Post by doublemax »

Pass a proper wxBitmapType to the LoadFile method, wxBITMAP_TYPE_JPEG or wxBITMAP_TYPE_ANY.
Use the source, Luke!
Post Reply