heribertolugo / ImageToLockscreen

Resize image canvas to fit Windows lockscreen
GNU General Public License v3.0
0 stars 0 forks source link

Performance Issue #6

Open heribertolugo opened 4 months ago

heribertolugo commented 4 months ago

after changing the blur effect to use System.Windows.Media instead of System.Drawing, the application is very resource intensive.

this may have to do with using a parallel for loop when processing image data.

we can try to refactor to create less Bitmap or Image objects and pass the same image object through the process. this was made in a hurry, so I'm sure new bitmap instances were created which do not need to be.

heribertolugo commented 4 months ago

this has been addressed and fixed in #9

however, some major refactoring can be done in that ImageHelper class.

WritableBitmap is being created multiple times, and the image data is being sent into byte array multiple times. These both should just be passed down.

also the arrays to store data for gaussian parallel blur are creating int arrays instead of byte. this increases memory usage for no reason.

the bitmap objects prior to blur operation cannot be re-used for blur, since they are immutable.