{"id":139,"date":"2024-08-18T19:25:02","date_gmt":"2024-08-18T19:25:02","guid":{"rendered":"https:\/\/www.mickiwiki.com\/?p=139"},"modified":"2024-08-18T19:25:04","modified_gmt":"2024-08-18T19:25:04","slug":"mixes","status":"publish","type":"post","link":"https:\/\/www.mickiwiki.com\/?p=139","title":{"rendered":"mixes"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"175\" src=\"https:\/\/www.mickiwiki.com\/wp-content\/uploads\/2024\/08\/mixed-1.png\" alt=\"\" class=\"wp-image-143\" srcset=\"https:\/\/www.mickiwiki.com\/wp-content\/uploads\/2024\/08\/mixed-1.png 875w, https:\/\/www.mickiwiki.com\/wp-content\/uploads\/2024\/08\/mixed-1-300x60.png 300w, https:\/\/www.mickiwiki.com\/wp-content\/uploads\/2024\/08\/mixed-1-768x154.png 768w\" sizes=\"auto, (max-width: 875px) 100vw, 875px\" \/><\/figure>\n\n\n\n<p>iterating over the image can change the alpha then.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/perl\nuse strict;\nuse warnings;\nuse Image::Imlib2;\nmy $bg = Image::Imlib2->load(\"pens.png\");\nmy @files=(\"blue.png\", \"red.png\"); \nmy @mix=(255,192,128,64,0);\nmy $clone_bg;\n\nfor (my $i=0;$i&lt;=4;$i++){\n$clone_bg=$bg->clone;\nblend($files&#91;0],$mix&#91;$i]);\nblend($files&#91;1],255-$mix&#91;$i]); \n$clone_bg->save(\"iterated_$i.png\");  \n}\n   \nsub blend{    \nmy($file,$new_alpha)=@_;\nmy $image=Image::Imlib2->load($file);\n\n$image->will_blend(0);#need this to be 0\n$image->has_alpha(1);\nmy $width = $image->width;\nmy $height = $image->height;\n\nfor my $y (0 .. $height - 1) {\n\t\n   for my $x (0 .. $width - 1) {\n     my  ($red, $green, $blue, $alpha) = $image->query_pixel($x, $y);\n     unless ($alpha==0){\n\t\t $image->set_colour($red, $green, $blue, $new_alpha);  \n         $image->draw_point($x, $y);\n           }\n    }\n  }\n\n$image->will_blend(1);\n$clone_bg->blend($image,1 , 0, 0, $width, $height, 0, 0, $width, $height);\nundef $image;\nreturn;\n }<\/code><\/pre>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>iterating over the image can change the alpha then.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139"}],"version-history":[{"count":2,"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":145,"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=\/wp\/v2\/posts\/139\/revisions\/145"}],"wp:attachment":[{"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mickiwiki.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}