converting from BMP to JPG Topic is solved

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
Qasim
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed May 23, 2007 3:41 pm
Location: London

converting from BMP to JPG

Post by Qasim »

Hi, I got the bmp file loaded in object bmp. Now I want to save it as JPG. Can some one please help with it. I tried, but it saves the file with 0kb i-e no data.
Any help will be appreciated.

here what I am doing

wxBitmap bmp;
wxImage jpg = bmp.ConvertToImage();
jpg.SaveFile("C:\\myfile.jpg", wxBITMAP_TYPE_JPEG );
Who doubts nothing, Knows nothing
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
Try with

Code: Select all

wxInitAllImageHandlers();
wxBitmap bmp(...);
bmp.SaveFile("Test.jpg",wxBITMAP_TYPE_JPEG);
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Post Reply