Skip to content

Commit

Permalink
ios/swift Pixelizator app
Browse files Browse the repository at this point in the history
  • Loading branch information
gsurma committed Jan 12, 2019
1 parent 042a5c7 commit 8ac54bb
Show file tree
Hide file tree
Showing 99 changed files with 3,916 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -66,3 +66,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
pixelizator.sketch
29 changes: 28 additions & 1 deletion README.md
@@ -1 +1,28 @@
# pixelizator
<h3 align="center">
<img src="assets/pixelizator_icon_web.png" width="300">
</h3>

# Pixelizator

https://github.com/bmaslakov/cocoa-close-pixelate

https://stackoverflow.com/questions/25510081/how-to-allow-user-to-pick-the-image-with-swift

https://gist.github.com/danyshaanan/6754465

## Swift (iOS)


## Python

### Usage
`python pixelizator.py <pixel_size> <scale>`

pixel_size: default 8
scale: default 1

### Input
<img src="python/input.png" width="300">

### Output
<img src="python/output.png" width="300">
Binary file added assets/pixelizator_icon_web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python/input.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added python/output.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions python/pixelizator.py
@@ -0,0 +1,22 @@
from PIL import Image
import sys


if len(sys.argv) > 1:
pixel_size = int(sys.argv[1])
else:
pixel_size = 8

if len(sys.argv) > 2:
scale = int(sys.argv[2])
else:
scale = 1

image = Image.open('input.png')
downscaled_image = image.resize((image.size[0]/pixel_size,
image.size[1]/pixel_size),
Image.NEAREST)
upscaled_image = downscaled_image.resize((downscaled_image.size[0]*pixel_size*scale,
downscaled_image.size[1]*pixel_size*scale),
Image.NEAREST)
upscaled_image.save('output.png')

0 comments on commit 8ac54bb

Please sign in to comment.