Page 1 of 1

Load, display, process and save an image with wxWidgets

Posted: Thu Aug 29, 2013 5:06 pm
by bertolino
Here is a small self-sufficient piece of code that shows how to deal with image files:
load the image, display it, process it (I mean modify the pixels the way you like) and then save it.
It can easily be extended to deal with many image processing.
The code is just one file with some comments.
Enjoy.

Pascal

Re: Load, display, process and save an image with wxWidgets

Posted: Thu Aug 29, 2013 5:53 pm
by doublemax
Thanks for sharing.

But a small advice: Converting the raw data to a wxImage and then to wxBitmap on each paint event is very inefficient and will lead to a noticeable slowdown with bigger images. You should keep a wxBitmap for display at all times and only update it when the image data changes.

Re: Load, display, process and save an image with wxWidgets

Posted: Fri Aug 30, 2013 7:07 am
by bertolino
doublemax wrote:Thanks for sharing.

But a small advice: Converting the raw data to a wxImage and then to wxBitmap on each paint event is very inefficient and will lead to a noticeable slowdown with bigger images. You should keep a wxBitmap for display at all times and only update it when the image data changes.
Thanks for your advice. You're totally right. I will update the code soon to improve that.