You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dd8092e
Browse filesBrowse the repository at this point in the historyBrowse files
* [newFeature] setOpacity processor
Processor used to set the max alpha value of a picture.
- processor added to base.py
- test added to test_processors.py
assertresult_1.mode=="RGBA"#mode of the output is RGBA
216
+
expected_histogram_1= [0]*256#initialize an empty histogram
217
+
expected_histogram_1[0] =nb_pixels#all pixels at 0
218
+
r,g,b,a=result_1.split()
219
+
asserta.histogram() ==expected_histogram_1#opacity is 0 on every pixel
220
+
221
+
result_2=SetOpacity(50).process(ref_1)
222
+
assertresult_2.mode=="RGBA"#mode of the output is RGBA
223
+
expected_histogram_2= [0]*256#initialize an empty histogram
224
+
expected_histogram_2[50] =nb_pixels#all pixels at 50
225
+
r,g,b,a=result_2.split()
226
+
asserta.histogram() ==expected_histogram_2#opacity is 0 on every pixel
227
+
228
+
result_3=SetOpacity(125).process(ref_1)
229
+
assertresult_3.mode=="RGBA"#mode of the output is RGBA
230
+
expected_histogram_3= [0]*256#initialize an empty histogram
231
+
expected_histogram_3[125] =nb_pixels#all pixels at 125
232
+
r,g,b,a=result_3.split()
233
+
asserta.histogram() ==expected_histogram_3#opacity is 0 on every pixel
234
+
235
+
#test on RGBA image
236
+
ref_2=Image.open(get_image_file("multiple_alpha_image.png")) #image 60x30px with following alpha values [0, 8, 32, 78, 147, 244] (300px for each values)
0 commit comments