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
Load, display, process and save an image with wxWidgets
Load, display, process and save an image with wxWidgets
- Attachments
-
- bertimage.cpp
- source code of bertimage
- (11.5 KiB) Downloaded 1087 times
Re: Load, display, process and save an image with wxWidgets
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.
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!
Re: Load, display, process and save an image with wxWidgets
Thanks for your advice. You're totally right. I will update the code soon to improve that.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.