# isBackRect=True,
                        # rect_fill=(255,255,255,180),
                        # font_color= LIGHTorDARK(image=img),# (255,255,255,255),
                        # isBackRect=False,
                        textYratio = 35,
                        textXratio = 70,
                        placeYRatio = 40
                        )

img = combineLogo(image=img,
                    mdc=drawMDClogo(),
                    # logo1=drawCustomLogo(logoPath=logo1Path),
                    # logo2=drawCustomLogo(logoPath=logo2Path),
                    # logo3=drawCustomLogo(logoPath=logo3Path),
                    # instagram= drawIGaccount(instaAccount='@Rzf.Gsh'),
                    hashTag= drawHashtag(hashTag='Hadist qudsi'),
                    logo1= drawHashtag(hashTag='Islamic quotes'),
                    targetHeight= int(img.size[1]/15),
                    isLight=True,
                    ratioWidth = 50,
                    ratioHeight = 80,
                    )
                    
img = drawAnotherSosmed(image=img,
                    ratioHeight=2.5,
                    useOverlay=True,
                    account_IG = '@rzf.gsh',
                    account_FB = 'M Razif Rizqullah',
                    account_WA = None,
                    account_LINE = 'r.linkgish',
                    account_TELEGRAM = None,
Exemplo n.º 2
0
def instaPostStyle2MainProgram(
    titleText='AI DESIGN',
    fontTitlePath='Font-lib/Comfortaa/Comfortaa-SemiBold.ttf',
    subTitleText='Instant Design',
    fontSubTitlePath='Font-lib/Love_Ya_Like_A_Sister/LoveYaLikeASister-Regular.ttf',  #'/Font-lib/Comfortaa/Comfortaa-SemiBold.ttf',
    logoAiDesign=None,
    logoMDC=None,
    logoYukShare=None,
    customLogo1=None,
    customLogo2=None,
    customHastagLogo=None,
    backgroundCategory=None,
    backgroundImage=None,
):
    # print('---------------')
    # print(fontTitlePath)
    # print('---------------')
    # print(fontSubTitlePath)
    if backgroundImage != '-- Pilih Kategori --':
        img = backgroundSelection(category=backgroundCategory).convert(
            'RGB')  #Select background from random image in a category
    elif backgroundImage:
        img = Image.open(backgroundImage)
    #there is 4 category City, Dawn, Dusk, Night
    # img = Image.open('/home/linkgish/Desktop/AiDesign_01/Image-lib/background-lib/City/city-wallpaper-27.jpg')  #Import a single image as background
    #Converting PIL to OpenCV format (2 Dimension to 3 Dimensional Array)
    img = np.array(img)
    img = img[:, :, ::-1].copy()
    #Gamma correction using openCV
    gammaIs = whatsGamma(img)  #Determine the number of gamma correction
    img = GammaCorrection(image=img,
                          gamma=gammaIs)  #Apply the gamma correction
    img_size = 2000  #Change the image size, so it will be better for uploading
    img = crop1x1_cv2(
        img, img_size)  #Crop the image in square dimension using OpenCV
    # Convert OpenCV format to PIL format
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    img = Image.fromarray(img)
    #Done, now any further code is using PIL instead
    #Making the big text, and small text
    # maroon = '#FFA781'

    img = drawTitleStyle2(
        bigText=titleText,  #"GEMPA BUMI", 
        fontPath=os.path.abspath(
            fontTitlePath
        ),  #'/home/linkgish/Desktop/AiDesign_01/Font-lib/Love_Ya_Like_A_Sister/LoveYaLikeASister-Regular.ttf',
        littleText=subTitleText,  #'Hanya Peristiwa Alam?',
        subFontPath=os.path.abspath(fontSubTitlePath),
        imageSource=img,
        bigTextColor=randomMaterialColor(
            typeColor=LIGHTorDARK(image=img)
        ),  #LIGHTorDARK(image=img),#, #selectColor(color='grey'),
        littleTextColor=randomMaterialColor(typeColor=LIGHTorDARK(image=img)),
        bigFontSize=1300,
        littleTextSize=500,
    )
    # Draw the copyright section in the bottom right
    img = drawCopyright(image=img)
    # Draw some logo in a combination size
    islogoMDC = None
    if logoMDC == True:
        islogoMDC = drawMDClogo()

    islogoYukShare = None
    if logoYukShare == True:
        islogoYukShare = drawHashtag(hashTag='YUK SHARE')

    img = combineLogo(
        image=img,
        mdc=islogoMDC,
        logo1=islogoYukShare,  # drawCustomLogo(logoPath=logo1Path),
        # logo2=drawCustomLogo(logoPath=logo2Path),
        # logo3=drawCustomLogo(logoPath=logo3Path),
        # instagram= drawIGaccount(instaAccount='@Rzf.Gsh'),
        hashTag=drawHashtag(hashTag='baik berisik'),
        # logo3= drawHashtag(hashTag='generasi tarbiyah'),
        targetHeight=int(img.size[1] / 15),
        isLight=True,
        ratioWidth=50,
        ratioHeight=80,
    )

    # Drw socmed account left it None or Blank if there is no account
    img = drawAnotherSosmed(
        image=img,
        useOverlay=True,
        account_IG='Rzf.Gsh',
        account_FB='M Razif Rizqullah',
        # account_TELEGRAM='LinkGish',
        account_WA=None,
        account_LINE=None,
        account_WEB=None,
        # account_TWITTER = 'LinkGish',
        account_YOUTUBE=None,
        ratioHeight=2.5,
        # fontColor=(55,71,79),
    )
    # Use time as a unique file name, so it will not be duplicated in the future
    nowTime = ctime()
    # Input variable of time into the string
    savePath = (
        '/home/linkgish/Desktop/AiDesign_01/Result-lib/instaStyle2/Style2 {}.jpg'
    ).format(nowTime)
    img.save(savePath)
    print('Successfully saved at : ', savePath)  # Notification while done
    img.thumbnail(
        (500, 500)
    )  # Just show thumbnail instead of full size image, because we should keep the quality
    img.show()  #Show the result


# instaPostStyle2MainProgram()
# print(os.path.abspath('AiDesign_01/Font-lib/Comfortaa/Comfortaa-SemiBold.ttf'))
Exemplo n.º 3
0
print('Background loaded success....')
# Draw the copyright section in the bottom right
img = drawCopyright(image=img)
# Draw some logo in a combination size
# Logo path to create
logo1Path = '/home/linkgish/Desktop/WebApp2/GeneticDesignProject/Image-lib/Logo-lib/logo-www.png'
logo2Path = '/home/linkgish/Desktop/WebApp2/GeneticDesignProject/Image-lib/Logo-lib/logo-whatsapp.png'
logo3Path = '/home/linkgish/Desktop/WebApp2/GeneticDesignProject/Image-lib/Logo-lib/logo-telegram.png'
img = combineLogo(
    image=img,
    mdc=drawMDClogo(),
    # logo1=drawCustomLogo(logoPath=logo1Path),
    # logo2=drawCustomLogo(logoPath=logo2Path),
    # logo3=drawCustomLogo(logoPath=logo3Path),
    # instagram= drawIGaccount(instaAccount='@Rzf.Gsh'),
    hashTag=drawHashtag(hashTag='baik berisik'),
    targetHeight=int(img.size[1] / 15),
    isLight=True,
    ratioWidth=50,
    ratioHeight=80,
)
# Drw socmed account left it None or Blank if there is no account

img = drawAnotherSosmed(
    image=img,
    account_IG='@Rzf.Gsh',
    account_FB='M Razif Rizqullah',
    # account_TELEGRAM='LinkGish',
    # account_WA = '082238639221' ,
    # account_LINE = 'r.linkgish' ,
    # account_WEB = 'linkgish.com' ,
Exemplo n.º 4
0
#Making the text
img = drawTitleStyle2(bigText="Lebih dari ini",
                        littleText='pernah kita lalui',
                        imageSource=img,
                        bigTextColor=(255,255,255,255), #selectColor(color='grey'),
                        littleTextColor=(255,224,130),
                        bigFontSize=1300,
                        littleTextSize=500,
                        )

img = drawCopyright(image=img)
img = combineLogo(image=img,
                    mdc=drawMDClogo(),
                    instagram= drawIGaccount(instaAccount='@Rzf.Gsh'),
                    hashTag= drawHashtag(hashTag='Quotes Muslim'),
                    targetHeight= int(img.size[1]/15),
                    )

img = drawAnotherSosmed(image=img,
                    account_IG='@Rzf.Gsh',
                    account_FB='M Razif Rizqullah',
                    account_TELEGRAM='LinkGish',
                    account_WA = None ,
                    account_LINE = None ,
                    account_WEB = None ,
                    account_TWITTER = 'LinkGish',
                    account_YOUTUBE = None,
                    ratioHeight=2,
                    )