I've been flirting with the idea of storing the deep zoom images of a Pivot collection in a database as part of a solution for dynamically generating collections on the fly. To do that I need to know how large each image can get in bytes. Sounds like a job for PowerShell.
Using an already generated Pivot collection I ran the following script to find the average, maximum and minimum file sizes of the images at each zoom level.
$images = Get-ChildItem -Filter 0_0.png -Recurse
"0 stats"
$images | where { $_.FullName -like "*Images\*_files\0\0_0.png" } | measure -Average -Maximum -Minimum -Property Length
"1 stats"
$images | where { $_.FullName -like "*Images\*_files\1\0_0.png" } | measure -Average -Maximum -Minimum -Property Length
# and so on...
All the images are retrieved and stored in the $images
variable. They're then filtered with a pipe using where
and like
, and then crunched with another pipe using measure
.
The end result is something like this...
0 stats
Count : 37666
Average : 117.089709552381
Sum :
Maximum : 163
Minimum : 106
Property : Length
1 stats
Count : 37666
Average : 129.242048531832
Sum :
Maximum : 170
Minimum : 113
Property : Length
This will help me roughly determine the column sizes if I go down this road. I love how easy it is to do set based operations in PowerShell.
There are 0 comments.
Newer
Remove Unversioned Files
Newer
Remove Unversioned Files
browse with Pivot
Codility Nitrogenium Challenge
OS X Lock
HACT '13
Codility Challenges
Priority Queue
Architecture (13)
ASP.NET (2)
ASP.NET MVC (13)
Brisbane Flood (1)
Building Neno (38)
C# (4)
Challenges (3)
Collections (1)
Communicator (1)
Concurrency Control (2)
Configuration (1)
CSS (5)
DataAnnotations (2)
Database (1)
DotNetOpenAuth (2)
Entity Framework (1)
FluentNHibernate (2)
Inversion of Control (5)
JavaScript (1)
jQuery (4)
Kata (2)
Linq (7)
Markdown (4)
Mercurial (5)
NHibernate (20)
Ninject (2)
OpenID (3)
OS X (1)
Pivot (6)
PowerShell (8)
Prettify (2)
RSS (1)
Spring (3)
SQL Server (5)
T-SQL (2)
Validation (2)
Vim (1)
Visual Studio (2)
Windows Forms (3)
Windows Service (1)
Comments
Leave a Comment
Please register or login to leave a comment.