for imageRef in images: fileName, squareImage = imageRef fileNameParts = fileName.split(os.sep) fileName = fileNameParts[len(fileNameParts)-1] imageEdit.logPrint(fileName, "bold") outputDir = THISDIR + "/output/" + fileName + "/proj-icon" # Proj-icon does not want to be a mask if (imageEdit.getImageDesc(squareImage) == "mask"): textName = fileName.split('.')[0] imageEdit.saveImage(outputDir + "/name.png", imageEdit.addDropShadowSimple( imageEdit.roundCornersAntiAlias( imageEdit.resizeImageSquare( imageEdit.addText(squareImage, textName), "0.5x"), 64), [-10, 10]) ) squareImage = imageEdit.removeImagePadding(squareImage, 64) roundImage = imageEdit.roundCornersAntiAlias(squareImage, 256) squircleImage = imageEdit.roundCornersAntiAlias(squareImage, 102) # Google Play Rounding # store-google-play-raster - Drop shadow, radius 20% (102,51) googlePlay = imageEdit.addDropShadowSimple(squircleImage, [-10, 10]) imageEdit.saveImage(outputDir + "/proj-icon.png", imageEdit.resizeImageSquare(googlePlay, 256))
def test_getImageDesc_null(): assert(imageEdit.getImageDesc(imageEdit.resizeImageSquare(IMAGE, 256)) == "unknown")
# Image in should be 512px images = imageEdit.openImagesInDir(THISDIR + "/input/*") for imageRef in images: fileName, squareImage = imageRef fileNameParts = fileName.split(os.sep) fileName = fileNameParts[len(fileNameParts) - 1] imageEdit.logPrint(fileName, "bold") outputDir = THISDIR + "/output/" + fileName storeDir = outputDir + "/store" pwaDir = outputDir + "/pwa" # Create a mask image and then convert to icon if (imageEdit.getImageDesc(squareImage) == "mask"): imageEdit.saveImage(pwaDir + "/mask.png", imageEdit.resizeImageSquare(squareImage, 512)) squareImage = imageEdit.removeImagePadding(squareImage, 64) roundImage = imageEdit.roundCornersAntiAlias(squareImage, 256) squircleImage = imageEdit.roundCornersAntiAlias( squareImage, 102) # Google Play Rounding ''' Store Images ''' # store-windows - Size 300px imageEdit.saveImage( storeDir + "/store-windows.png", imageEdit.resizeImageSquare(squareImage, "0.5859375x")) # store-google-play - Size 512, png32 imageEdit.saveImage(storeDir + "/store-google-play.png", squareImage,
def test_getImageDesc_mask(): assert(imageEdit.getImageDesc(imageEdit.resizeImageSquare(IMAGE, 640)) == "mask")
def test_resizeImage_x0_5(): assert(imageEdit.resizeImageSquare(IMAGE, "0.5x").size == (256, 256))
def test_resizeImage_x2(): assert(imageEdit.resizeImageSquare(IMAGE, "2x").size == (1024, 1024))
def test_resizeImageSquare_256(): assert(imageEdit.resizeImageSquare(IMAGE, 256).size == (256, 256))
def test_resizeImageSquare_1024(): assert(imageEdit.resizeImageSquare(IMAGE, 1024).size == (1024, 1024))