Load, display, process and save an image with wxWidgets

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France

Load, display, process and save an image with wxWidgets

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
doublemax
Moderator
Moderator
Posts: 19164
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post 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.
Use the source, Luke!
bertolino
Experienced Solver
Experienced Solver
Posts: 77
Joined: Wed Aug 14, 2013 8:07 am
Location: France

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

Post 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.