wxImage.GetOptionInt method on JPEG fails

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
greg
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Sep 12, 2008 7:17 am

wxImage.GetOptionInt method on JPEG fails

Post by greg »

Hi
I have a problem while using GetOptionInt method from wxImage on JPG files.
I want to get the information on quality of JPG file.
GetOptionInt method always returns 0.
Whats wrong in my code?

Code: Select all

xImage img;
img.LoadFile("test.jpg", wxBITMAP_TYPE_JPEG);
printf ("option=%i\n", img.GetOptionInt(wxIMAGE_OPTION_QUALITY));
Regards
Greg
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxImage.GetOptionInt method on JPEG fails

Post by doublemax »

wxIMAGE_OPTION_QUALITY is write-only. It's only used to set the quality before saving a JPEG.
Use the source, Luke!
greg
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Sep 12, 2008 7:17 am

Re: wxImage.GetOptionInt method on JPEG fails

Post by greg »

Thanks for Your answer
So this another problem.
I'm reading JPG file to wxImage.
How can I get image quality on JPEG file?
Regards
Greg
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxImage.GetOptionInt method on JPEG fails

Post by doublemax »

How can I get image quality on JPEG file?
To my best knowledge this information is not stored directly in the JPG file. The only way to do it would be to read the quantization tables, compare them to the standard tables and do an "educated guess".
Use the source, Luke!
greg
Earned some good credits
Earned some good credits
Posts: 111
Joined: Fri Sep 12, 2008 7:17 am

Re: wxImage.GetOptionInt method on JPEG fails

Post by greg »

Thanks Doublemax
Now it's clear for me.
Regards
Greg
Post Reply