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 » Tue May 28, 2013 11:12 am

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: 15068
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxImage.GetOptionInt method on JPEG fails

Post by doublemax » Tue May 28, 2013 11:29 am

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 » Tue May 28, 2013 11:53 am

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: 15068
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxImage.GetOptionInt method on JPEG fails

Post by doublemax » Tue May 28, 2013 11:59 am

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 » Tue May 28, 2013 12:10 pm

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

Post Reply