私はこれについていくつかのことを読んだが、私はそれを自分のコードに入れる方法を理解することはできない。Pixel per Pixelイメージ、透明になった黒色
ここでは、次のとおりです。
function go($image) {
// Open the image
$getimage=imagecreatefrompng($image);
//Get the width/height
$w = imagesx($getimage);
$h = imagesy($getimage);
//init Count variable, when it reach the width, skip a line
$count = 0;
// For each line
for($y=0;$y<$h;$y++) {
// For each column
for($x=0;$x<$w;$x++) {
$rgba = imagecolorat($getimage, $x, $y);
$r = ($rgba >> 16) & 0xFF;
$g = ($rgba >> 8) & 0xFF;
$b = $rgba & 0xFF;
$a = ($rgba & 0x7F000000) >> 24;
echo '<div class="pix" style="background-color: rgba('.$r.', '.$g.', '.$b.', '.$a.');"></div>';
$count++;
if($count==$w) {echo '<br>'; $count = 0; }
}
}
echo $pixel_gen;
}
オユはそれがどのように見えるかを確認したい場合は、clicクリックここ:http://narks.xtreemhost.com/
し、任意のアイコンをダブルクリックし、ポップアップが表示されます。 (注:任意のアイコン上のdbl- clinkingは、同じ画像を表示します(私はまだこれを修正しませんでした)
どのように私は黒のピクセルをアルファで実際のピクセルのように見せることができますか?
ありがとうございました!
EDITED (私はスペースを節約したいので、新しいコード、私は最初の行を入れて)
function go($image) {
// Open the image
$getimage=imagecreatefrompng($image);
imagealphablending($getimage, false);
imagesavealpha($getimage, true);
//Get the width/height
$w = imagesx($getimage);
$h = imagesy($getimage);
[...]
に、それが今どのように見えるかを確認上記のウェブサイトを訪問し、ダブルクリックしますアイコン。
EDIT 2 Iだけで(テスト用)試み:
$getimage=imagecreatefrompng('iconDB/lib/chat_fav_48.png');
imagealphablending($getimage, false);
imagesavealpha($getimage, true);
header("Content-type: image/png");
imagepng($getimage);
imagedestroy($getimage);
、次いで
$getimage=imagecreatefrompng('iconDB/lib/chat_fav_48.png');
header("Content-type: image/png");
imagepng($getimage);
imagedestroy($getimage);
と最初は大丈夫であり、第二の画素が黒します。それで、各ピクセルのRGBカラーを取得し、表示するときです。誰もが間違いを見て?
のためにそれが役に立つことを願っています。私のコードのために編集されたオリジナルの記事を見てください。ここ(http://narks.xtreemhost.com/)を見て、アイコンをダブルクリックしてください。 –