Skip to content

SparrowJang/icon_converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Icon Converter

Introduction

This is a icon converter.It is able to transform image to icon.

Dependency

If you want to run it your device, please make sure you have installed this.

  • pgmagick > 0.5.0

Installation

git clone https://github.com/SparrowJang/icon_converter

cd icon_converter

sudo python setup.py install

Usage

Basic example

Use http or local file to convert

from icon_converter import converter

#target image ( http or local )
path = "http://example.com/test.png"

#resize and crop image
size = {"width":40,"height":40}

border = {
    "size":{"width":2,"height":2},
    "color":"#BBBBBB",
    "backgroundColor":"#FFFFFF"
}

blob = converter.convert_by_path( path, size, border )

User binary or base64 to convert

f = open( "test.png" )

data = f.read()

base64data = base64.b64encode( data )

#binary data
converter.convert( data, size, border )

#base64
converter.convert( base64, size, border, format_type = "base64" )

If you don't need arrow, the "arrow" parameter set to False.

converter.convert( data, size, border, arrow = False )

# or

converter.convert_by_path( path, size, border, arrow = False )

Get a base64.

blob = converter.convert( data, size, border )

blob.base64()

Save a file.

f = open( "arrow.png", "w" )

f.write( blob.data )

f.close()

About

This is icon converter.It is able to convert image to icon.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages