Exemple #1
0
    im = Image.open(LOC + imgList[i])
    # Store the current image in the named tuple
    currImg = ImageFile(fileName=imgList[i], fileType=im.format, fileSize=im.size, fileColorMode=im.mode,
                        fileLOC=LOC + imgList[i])
# --------- images obtained ---------
    # Pring image imformation
    imgMap.printImageFile(currImg)

    # create thumbnails
    imgMap.createThumbnail(currImg, LOC + "thumbnails\\")
    # ----- apply filters -----
    # loading() here used to add to the progress bar
    loading()

    # apply a blur filter
    imgMap.applyFilter(currImg, LOC + "filters\\BLUR\\", "BLUR", [9])
    loading()
    # apply a contor filter
    imgMap.applyFilter(currImg, LOC + "filters\\CONTOUR\\", "CONTOUR")
    loading()
    # apply a detail filter
    imgMap.applyFilter(currImg, LOC + "filters\\DETAIL\\", "DETAIL")
    loading()
    # apply an edge enhance filter
    imgMap.applyFilter(currImg, LOC + "filters\\EDGE_ENHANCE\\", "EDGE_ENHANCE")
    loading()
    # apply an emboss filter
    imgMap.applyFilter(currImg, LOC + "filters\\EMBOSS\\", "EMBOSS")
    loading()
    # apply a find edges filter
    imgMap.applyFilter(currImg, LOC + "filters\\FIND_EDGES\\", "FIND_EDGES")
def test_applyFilter_validimage():
    """Test for valid image"""
    global testimage_valid, outp
    assert imgMap.applyFilter(testimage_valid, outp, "BLUR", [9]) == None
def test_applyFilter_invalidFilterType2():
    global testimage_valid, outp
    assert imgMap.applyFilter(testimage_filt1, outp, "AAAAAA", [9]) == False
def test_applyFilter_invalidFilterType3():
    global testimage_valid, outp
    assert imgMap.applyFilter(testimage_filt1, outp, "284O@[]G£7HF^H", [9]) == False
def test_applyFilter_invalidFilename():
    """test for invalid file name"""
    global testimage_filt1, outp
    assert imgMap.applyFilter(testimage_filt1, outp, "BLUR", [9]) == False