Skip to content

tylerwiersing/6px-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python library for 6px

Python library for interacting with the 6px API. This library includes methods that makes sending image processing jobs to 6px easier.

Getting Started

Install Pip:

$ pip install px

Sudo-chop if necessary... ##Examples If you want to simply upload an image to the 6px CDN:

from _6px import PX

px = PX.init(
    user_id='YOUR USER ID',
    api_key='YOUR API KEY',
    api_secret='YOUR API SECRET'
)

px.load('taxi', 'https://s3.amazonaws.com/ooomf-com-files/mtNrf7oxS4uSxTzMBWfQ_DSC_0043.jpg')

out = px.output({ 'taxi': 'unsplashed_taxi' })
out.tag('raw').url('6px');

px.save()

Given that vintage photos are kind of kind of popular right now, let's take this up a notch:

from _6px import PX

px = PX.init(
	user_id='YOUR USER ID',
	api_key='YOUR API KEY',
	api_secret='YOUR API SECRET'
)

px.load('taxi', 'https://s3.amazonaws.com/ooomf-com-files/mtNrf7oxS4uSxTzMBWfQ_DSC_0043.jpg')

out = px.output({ 'taxi': 'unsplashed_taxi' })
out.tag('vintage')
	.url('6px')
	.filter({ sepia: 70 });

px.save()

So, we have a bit of an extreme sepia effect going on here, but that's fine. I think this deserves to be more of a thumbnail. We are going to resize it now:

from _6px import PX

px = PX.init(
	user_id='YOUR USER ID',
	api_key='YOUR API KEY',
	api_secret='YOUR API SECRET'
)

px.load('taxi', 'https://s3.amazonaws.com/ooomf-com-files/mtNrf7oxS4uSxTzMBWfQ_DSC_0043.jpg')

out = px.output({ 'taxi': 'unsplashed_taxi' })
out.tag('vintage_thumb')
	.url('6px')
	.filter({ sepia: 70 })
	.resize({ width: 75 });

px.save()

Another thing we can do is change the dominate color of an image:

from _6px import PX

px = PX.init(
	user_id='YOUR USER ID',
	api_key='YOUR API KEY',
	api_secret='YOUR API SECRET'
)

px.load('taxi', 'https://s3.amazonaws.com/ooomf-com-files/mtNrf7oxS4uSxTzMBWfQ_DSC_0043.jpg')

out = px.output({ 'taxi': 'unsplashed_taxi' })
out.tag('green')
	.url('6px')
	.filter({colorize: { hex: '#00FF00', strength: 80 }});

px.save()

Let's blur the image at the same time.

from _6px import PX

px = PX.init(
	user_id='YOUR USER ID',
	api_key='YOUR API KEY',
	api_secret='YOUR API SECRET'
)

px.load('taxi', 'https://s3.amazonaws.com/ooomf-com-files/mtNrf7oxS4uSxTzMBWfQ_DSC_0043.jpg')

out = px.output({ 'taxi': 'unsplashed_taxi' })
out.tag('green_blur')
	.url('6px')
	.filter({
		colorize: { hex: '#00FF00', strength: 80 },
		stackBlur: 20
	});

px.save()

Now that we have covered some of the simple use cases, feel free to refer to our documentation!

##API Documentation

Keep us posted on the cool stuff you are doing by sending an email to [email protected]. If you come across any issues or have suggestions please open an issue on GitHub.

Analytics

About

Python module for 6px

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages