Skip to content

Commit

Permalink
Added readme and publish info.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clint Pearson committed Jun 19, 2015
1 parent e87dbea commit e6f52dc
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 2 deletions.
51 changes: 51 additions & 0 deletions Pak/Pak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<SupportUrl>https://github.com/ckpearson/Pak</SupportUrl>
<ProductName>Pak</ProductName>
<PublisherName>Clint</PublisherName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -38,6 +59,18 @@
<Prefer32Bit>false</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>43BA2A176B60CCCB955A55277D87F2F7457BBA06</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Pak_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="MahApps.Metro">
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
Expand Down Expand Up @@ -129,6 +162,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Pak_TemporaryKey.pfx" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -145,6 +179,23 @@
<ItemGroup>
<Resource Include="Resources\Entypo-license.txt" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
4 changes: 2 additions & 2 deletions Pak/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Pak")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Image File Pack Application")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pak")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyCopyright("Copyright Clint Pearson © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
## What is Pak?

Pack lets you take any file (say an excel workbook) and encode it as a PNG image for sharing online where file uploads aren't usually allowed.

## Why?

It's not possible to share files like test data etc in GitHub issues / pull requests, by avoiding e-mail / shared drives, Pak overcomes:

1. Forgetting where that data is
2. Accidental deletion of that data
3. Requirement to store the file on a shared drive / in an e-mail inbox

## Limitations

You can store pretty much any type of file you want to, Pak will ensure a minimum size of 200x200 pixels to make the image more visible; it fills in the non-data parts of the image with nice colours.

The data itself is LZMA compressed (7-zip) to help reduce the size of the image, but obviously some files are just going to be too big to practically share this way.

### What about multiple files?

You can share multiple files in a single image, just compress them first (e.g. a zip / 7-zip archive).

## How do I use it?

Just launch the application and you'll see the main screen:

![App Window](/readme-assets/appwin.PNG)

From here just drag the file you want to share, or the Pak'd image from a website; the app will then create an image for you / offer to save the unpacked file.

Once an image has been created, you'll see something like:

![New Image](/readme-assets/imagecreate.PNG)

Now you just need to drag that image into wherever you want to share it, this will typically be the GitHub comment box.

## How does it work?

At a very high-level it does the following:

1. Compresses the file you give it
2. Drops the trailing zeroes from the end of the compressed data and remembers how many zeroes it got rid of (this makes the image smaller)
3. Creates a byte array containing the following:
1. A special token so the app can recognise it's a Pak'd image
2. The number of bytes the filename is long
3. The filename in UTF-8 byte form
4. The number of zeroes that were dropped
5. The length of the data being written
6. The compressed data
4. Groups the data into chunks of 4 bytes
* This is because the image is 32-bit ARGB meaning 4 bytes can be encoded in a single pixel
5. Works out how big the image needs to be to accommodate all the data
6. Adjust the image size up if it's less than the minimum size
7. Walks bottom > top and left > right in the image
8. Sets the colour and alpha of each pixel based on data meant to go at that point
1. If no data is available for this point, it uses a random colour from a pallette
2. It also adds a black border around the non-data section on the left, right and bottom edges
9. Saves the image somewhere and makes it draggable from the app.

To get back from an image is basically the same in reverse, except:

1. **All** the data from the image is read (including the random section)
2. The token, filename, dropped and length data is read out
3. The data is checked (e.g. is token correct)
4. The specific section of the data that is the compressed data is read
5. The compressed data is padded with the dropped zeroes
6. The compressed data is uncompressed
7. The app saves the uncompressed data where you choose.

Binary file added readme-assets/appwin.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/imagecreate.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e6f52dc

Please sign in to comment.