def AddExpansion(image, expansion):
    expansion_symbol = None
    if expansion.lower() == "none" or expansion.lower() == "blank":
        return
    if expansion is not '':
        expansion_symbol = PIL_Helper.LoadImage(
            os.path.join(ExpansionIconsPath, expansion))
    if GlobalExpansionIcon is not None:
        expansion_symbol = PIL_Helper.LoadImage(
            os.path.join(ExpansionIconsPath, GlobalExpansionIcon))

    if expansion_symbol:
        image.paste(expansion_symbol, Anchors["Expansion"], expansion_symbol)
def AddOverlay(image, filename):
    if filename == "":
        return
    if os.path.exists(os.path.join(OverlayPath, filename)):
        overlay = PIL_Helper.LoadImage(os.path.join(OverlayPath, filename))
    else:
        return
    # Overlays should be the same size as the frame so just paste this on
    image.paste(overlay, (0, 0), overlay)
예제 #3
0
def main(input_folder=".", output_folder="../thumb"):
    CleanDirectory(output_folder, "", "*.*")
    for image_file in glob.glob(os.path.join(input_folder, '*.png')):
        image_filename = os.path.basename(image_file)
        # print("Current file: {}").format(image_file)

        print("Resizing Image: {}").format(image_filename)
        image = PIL_Helper.LoadImage(image_file)
        image_thumb = PIL_Helper.ResizeImage(image, VASSAL_SCALE)
        SaveCard(os.path.join(output_folder, image_filename), image_thumb)
def AddCardArt(image, filename, anchor):
    if filename == "NOART":
        return
    if os.path.exists(os.path.join(CardPath, filename)):
        art = PIL_Helper.LoadImage(os.path.join(CardPath, filename))
    else:
        art = random.choice(ArtMissing)
    # Find desired height of image based on width of 600 px
    w, h = art.size
    h = int((float(ART_WIDTH) / w) * h)
    # Resize image to fit in frame
    art = PIL_Helper.ResizeImage(art, (ART_WIDTH, h))
    image.paste(art, anchor)
def AddWatermark(image):
    if WatermarkImage is None:
        return image
    if os.path.exists(WatermarkImage):
        watermark = PIL_Helper.LoadImage(WatermarkImage)
    else:
        return image

    if image.mode != 'RGBA':
        image = image.convert('RGBA')

    if watermark.mode != 'RGBA':
        watermark = watermark.convert('RGBA')
    else:
        watermark = watermark.copy()

    alpha = watermark.split()[3]
    alpha = ImageEnhance.Brightness(alpha).enhance(0.25)  # 25% Opacity

    watermark.putalpha(alpha)
    watermarklayer = Image.new('RGBA', image.size, (0, 0, 0, 0))
    watermarklayer.paste(watermark, (0, 0))
    return Image.alpha_composite(image, watermarklayer)
def GetExpansionIcon(expansion):
    return PIL_Helper.LoadImage(ExpansionIconsPath + expansion)
    "Title": (-65 - 50, 160),
    "TitleTwoLine": (-65 - 50, 159),
    "TitleSmall": (-65 - 50, 157),
    "Bar": (-68 - 50, 598 + 67),
    "Body": (base_w_center, 735),
    "BodyLeft": (body_w_left, 735),
    "BodyShiftedUp": (base_w_center, 730),
    "BodyLeftShiftedUp": (body_w_left, 730),
    "Flavor": (base_w_center, -110),
    "FlavorLeft": (base_w_left, -110),
    "Expansion": (640 + 50, 525 + 63),
    "Copyright": (-38 - 50, -13 - 61)
}

ArtMissing = [
    PIL_Helper.LoadImage(CardPath + "artmissing01.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing02.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing03.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing04.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing05.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing06.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing07.png"),
]

Frames = {
    "START":
    PIL_Helper.LoadImage(BleedTemplatesPath + "BLEED-Blank-Start-bleed.png"),
    "Warning":
    PIL_Helper.LoadImage(CardPath + "BLEED_Card - Warning.png"),
    "Warning2":
    PIL_Helper.LoadImage(CardPath + "BLEED_warning_CofK2.png"),
예제 #8
0
    "LoneSymbol": (108, 153),
    "TimelineSymbol": (58 + 50, 535 + 63),
    "GoalSymbol2": (108, 613),
    "Title": (-65 - 50, 160),
    "TitleTwoLine": (-65 - 50, 159),
    "TitleSmall": (-65 - 50, 157),
    "Bar": (-68 - 50, 598 + 67),
    "Body": (base_w_center, 735),
    "BodyShiftedUp": (base_w_center, 730),
    "Flavor": (base_w_center, -110),
    "Expansion": (640 + 50, 525 + 63),
    "Copyright": (-38 - 50, -13 - 61)
}

ArtMissing = [
    PIL_Helper.LoadImage(CardPath + "/artmissing01.png"),
    PIL_Helper.LoadImage(CardPath + "/artmissing02.png"),
    PIL_Helper.LoadImage(CardPath + "/artmissing03.png"),
    PIL_Helper.LoadImage(CardPath + "/artmissing04.png"),
    PIL_Helper.LoadImage(CardPath + "/artmissing05.png"),
    PIL_Helper.LoadImage(CardPath + "/artmissing06.png"),
    PIL_Helper.LoadImage(CardPath + "/artmissing07.png"),
]

Frames = {
    "START":
    PIL_Helper.LoadImage(ResourcePath + "/BLEED-Blank-Start-bleed.png"),
    "Warning":
    PIL_Helper.LoadImage(CardPath + "/BLEED_Card - Warning.png"),
    "Pony":
    PIL_Helper.LoadImage(ResourcePath + "/BLEED-Blank-Pony-bleed.png"),
예제 #9
0
    "LoneSymbol": (108, 153),
    "TimelineSymbol": (58 + 50, 535 + 63),
    "GoalSymbol2": (108, 613),
    "Title": (-65 - 50, 160),
    "TitleTwoLine": (-65 - 50, 159),
    "TitleSmall": (-65 - 50, 157),
    "Bar": (-68 - 50, 598 + 67),
    "Body": (base_w_center, 735),
    "BodyShiftedUp": (base_w_center, 730),
    "Flavor": (base_w_center, -110),
    "Expansion": (640 + 50, 525 + 63),
    "Copyright": (-38 - 50, -13 - 61)
}

ArtMissing = [
    PIL_Helper.LoadImage(CardPath + "artmissing01.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing02.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing03.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing04.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing05.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing06.png"),
    PIL_Helper.LoadImage(CardPath + "artmissing07.png"),
]

Frames = {
    "START": PIL_Helper.LoadImage(BleedTemplatesPath + "BLEED-Blank-Start-bleed.png"),
    "Warning": PIL_Helper.LoadImage(CardPath + "BLEED_Card - Warning.png"),
    "Pony": PIL_Helper.LoadImage(BleedTemplatesPath + "BLEED-Blank-Pony-bleed.png"),
    "Ship": PIL_Helper.LoadImage(BleedTemplatesPath + "BLEED-Blank-Ship-bleed.png"),
    "Rules1": PIL_Helper.LoadImage(CardPath + "BLEED_Rules1.png"),
    "Rules3": PIL_Helper.LoadImage(CardPath + "BLEED_Rules3.png"),