wxImage::Scale - normal/high quality no difference Topic is solved
wxImage::Scale - normal/high quality no difference
Hello,
Using:
Windows XP sp2
wxWidgets 2.7.1 CVS from 11/10/2006
I have just noticed that wxWidgets 2.7.1 has new way to scale/resample images. I have tried to use both wxImage:Scale() with wxIMAGE_QUALITY_NORMAL and wxIMAGE_QUALITY_HIGH quality settings, but I don't see any difference between them.
I took an image of 768x576x32 and loaded it into 3 applications:
- api1 - loads and displays image with GdiPlus
- api2 - loads and displays image with wxImage normal quality
- api3 - loads and displays image with wxImage high quality
All images are "stretch" to 1024x768x32 image. I can see large quality difference between api1 and api2/3, but I don't see any difference between api2 and api3. Images seems to look identical. Any ideas why it is happening? Is wxIMAGE_QUALITY_HIGH really using bicubic resampling or is it work in progress?
Using:
Windows XP sp2
wxWidgets 2.7.1 CVS from 11/10/2006
I have just noticed that wxWidgets 2.7.1 has new way to scale/resample images. I have tried to use both wxImage:Scale() with wxIMAGE_QUALITY_NORMAL and wxIMAGE_QUALITY_HIGH quality settings, but I don't see any difference between them.
I took an image of 768x576x32 and loaded it into 3 applications:
- api1 - loads and displays image with GdiPlus
- api2 - loads and displays image with wxImage normal quality
- api3 - loads and displays image with wxImage high quality
All images are "stretch" to 1024x768x32 image. I can see large quality difference between api1 and api2/3, but I don't see any difference between api2 and api3. Images seems to look identical. Any ideas why it is happening? Is wxIMAGE_QUALITY_HIGH really using bicubic resampling or is it work in progress?
-
- Ultimate wxWidgets Guru
- Posts: 536
- Joined: Fri Jan 07, 2005 3:44 pm
- Location: Finland
- Contact:
Re: wxImage::Scale - normal/high quality no difference
I personally dont use the CVS version but maybe you could check the code to see if there actually are any differences (i.e. maybe the new api is not yet completed or something)?
Visual C++ 9.0 / Windows XP Pro SP3 / wxWidgets 2.9.0 (SVN) | Colligere
Hi!
Here's the source of the latest image.cpp: http://cvs.wxwidgets.org/viewcvs.cgi/wx ... cvs-markup
Seems like it realy uses bicubic resampling when stretching images.
Here's the source of the latest image.cpp: http://cvs.wxwidgets.org/viewcvs.cgi/wx ... cvs-markup
Seems like it realy uses bicubic resampling when stretching images.
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
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
I already browsed source and I know about wxImage::ResampleBicubic, but it doesn't explain why there is no difference between normal and high quality (and there should be a difference).upCASE wrote:Hi!
Here's the source of the latest image.cpp: http://cvs.wxwidgets.org/viewcvs.cgi/wx ... cvs-markup
Seems like it realy uses bicubic resampling when stretching images.
Do you think that it has something to do with the VC? From source I can't see any ifdefs for VC/GCC only for this function so I assume that this is "universal" method. Maybe this has something to do with wxUSE_GRAPHICS_CONTEXT, but there is no real explanation for it in both manual or source (or I have miss something).
Code: Select all
// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced
// 2D drawing API. (Still somewhat experimental)
//
// Please note that on Windows you will need to link with gdiplus.lib (use
// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your
// application if you want it to be runnable on pre-XP systems.
//
// Default is 0
//
// Recommended setting: 1
#ifndef wxUSE_GRAPHICS_CONTEXT
The output of the current version of wxImage::ResampleBicubic differs from what was originaly to be used. Someone seems to have optimized a bit too much. When I use the original code of ResampleBicubic (http://sourceforge.net/tracker/index.ph ... tid=309863) the images look better than what I get when I use current wxImage::ResampleBicubic.
It depends on what you can do with your code. I have no proposal, if wxImage::Scale or wxImage::ResampleBicubic need to behave fine.
But if you can add a function like "wxImage MyResampleBicubic(const wxImage &img)", then just follow above link, download the patch, open it with your texteditor and extract ResampleBicubic. Compile and fix the errors. They're easy to fix. In most cases you just need to call img.GetWidth() or similar.
But if you can add a function like "wxImage MyResampleBicubic(const wxImage &img)", then just follow above link, download the patch, open it with your texteditor and extract ResampleBicubic. Compile and fix the errors. They're easy to fix. In most cases you just need to call img.GetWidth() or similar.
-
- In need of some credit
- Posts: 7
- Joined: Wed Jul 14, 2010 12:15 pm
- Location: Ukraine Zhitomir
- Contact:
Hi all.
I downloaded wxWidgets 2.9.1 then
./сonfigure
make
sudo make install
and Code::Blocks 10.05
Then opened my old project and compile it(but I checked the buildinfo version of wxWidgets was 2.9.1). I have tried everything from:
wxImageResizeQuality (
wxIMAGE_QUALITY_NEAREST,
wxIMAGE_QUALITY_BILINEAR,
wxIMAGE_QUALITY_BICUBIC,
wxIMAGE_QUALITY_NORMAL,
wxIMAGE_QUALITY_HIGH
)
The quality was still poor.
I read about the patches: image_scaling_cvs.patch and image_scaling_2.6.3.patch please tell me how to use them.
Or tell my other solution.
I downloaded wxWidgets 2.9.1 then
./сonfigure
make
sudo make install
and Code::Blocks 10.05
Then opened my old project and compile it(but I checked the buildinfo version of wxWidgets was 2.9.1). I have tried everything from:
wxImageResizeQuality (
wxIMAGE_QUALITY_NEAREST,
wxIMAGE_QUALITY_BILINEAR,
wxIMAGE_QUALITY_BICUBIC,
wxIMAGE_QUALITY_NORMAL,
wxIMAGE_QUALITY_HIGH
)
The quality was still poor.
I read about the patches: image_scaling_cvs.patch and image_scaling_2.6.3.patch please tell me how to use them.
Or tell my other solution.