Skip to content

Quick action workflow to generate x1, x2 and x3 images from source file with specified size

Notifications You must be signed in to change notification settings

v-ivanyshyn/generate-ios-images-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Quick action workflow to generate x1, x2 and x3 images from source file with specified size.

How to use it?

Assuming you have installed the script to /Users/your_user/Library/Services directory, right click on the image you want to deal with, Services->Generate iOS images. You'll see dialog alert asking for desired image size. After entering it, the script generates appropriate @1x, @2x and @3x images in the current directory.

How it works?

Behind Automator steps there is Python script that takes input image, rescales it and saves:

import os, sys, subprocess
size = sys.argv[1]
filePath = sys.argv[2]
fileName, extension = os.path.splitext(filePath)
subprocess.call(['sips', '-Z', str(int(size) * 3), filePath, '--out', fileName + '@3x' + extension])
subprocess.call(['sips', '-Z', str(int(size) * 2), filePath, '--out', fileName + '@2x' + extension])
subprocess.call(['sips', '-Z', str(int(size) * 1), filePath, '--out', fileName + '@1x' + extension])

About

Quick action workflow to generate x1, x2 and x3 images from source file with specified size

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published