What is it?
My Samsung Galaxy S6 has 32GB build in storage, and I can only use 25.4 GB of it apparently. This very nice phone has everything, except external SD card storage.
In order to have all my images, from even before my S6 on my phone, I thought why not resize them.
I will only worry about the images take by my mobile phones, as it will be undoable for my photos from my single-lens reflex camera.
This mini project resizes all jpg images, from a directory, to a max of 2000 px (maintaining the aspect ratio), it then saves the image to a new directory with quality level 90.
The Quality category specifies the level of compression for an image. When used to construct an EncoderParameter, the range of useful values for the quality category is from 0 to 100. The lower the number specified, the higher the compression and therefore the lower the quality of the image. Zero would give you the lowest quality image and 100 the highest.
From: https://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoder.quality(v=vs.110).aspx
C# code
All the code can be found on my github: https://github.com/timdows/mobile-apps/tree/master/ImageResizer
As this is a quick and dirty project, I didn’t even took the effort to make the directories enter as arguments.
End result
What have I gained with this, well, all my phone photos from previous years now only take 18.45% of space (16.8 GB vs 3.10 GB).
The table also shows that my phone that I had in 2013, a Samsung Galaxy S3, made less megapixel photos hence it would require less storage for more photos.
Year | Amount of photos | Original size | Resized size |
---|---|---|---|
2012 | 1609 | 2.36 GB | 687 MB |
2013 | 2344 | 4.26 GB | 1.03 GB |
2014 | 804 | 1.23 GB | 307 MB |
2015 | 931 | 1.69 GB | 379 MB |
2016 | 1943 | 7.29 GB | 750 MB |
What could be better
- Use arguments for the input and output folder, as well as the image quality level.
Comments are closed.