Loading...

解決png圖檔GD合圖後背景色塊問題

Temperature: 0 °C

ChungChung
author_tools

重點在於設定圖片走透明通道~

$img = imagecreatefrompng($src);  
imagesavealpha($img,true);  
$thumb = imagecreatetruecolor(300,300);  
imagealphablending($thumb,false);//這裡很重要,意思是不合併顏色,直接用$img圖像顏色替換,包括透明色;
imagesavealpha($thumb,true); //這裡很重要,意思是不要丟了NewCanves圖像的透明色;
imagecopyresampled($thumb,$img,0,0,0,0,300,300,300,300);  
imagepng($thumb,"temp.png");

台北市內湖區江南街71巷75弄 Go

https://innstory.com/story-解決png圖檔GD合圖後背景色塊問題-503
寫程式筆記

Prev
 班長有什麼了不起我小學也當過班長

Next
屋簷上的秘密 

Nearby Attractions

台北市內湖區江南街71巷75弄-Nearby Attractions

  • 林秀俊墓 Go
  • 齊東街日式宿舍 Go
  • 司法大廈 Go
  • 臺北撫臺街洋樓 Go
  • 北投文物館 Go
  • 前南菜園日式宿舍 Go

About the Author

Chung

我是chung
網路工作者
主業是網站系統開發建置
副業是做夢,寫故事
作品請參考/teme.biz
做夢請參考/innstory.com
聯絡/chung.teme@gmail.com

#有人用筆寫日記,有人用歲月寫日記,有人用照片寫日記,而我,用innstory寫日記。

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

Android Studio 2.3 隨機改變背景顏色

Android Studio...

class55 開始學習APP 其實我照著工具書上的方式總是在宣告變數時會產生問題~ 例如工具書上寫...

吉他手

吉他手

回屏東,跟外甥女借了吉他回台北,想說,兒子二胡學習的還不錯,會不會是有部份也是遺傳了我未開發音樂基因...

地圖故事

地圖故事

map 一切都從第一張畫布開始... Innstory裡原先已有寫故事的功能,接著我把故事裡頭的照片...

Recommended reading

Other stories happened at this address

PHP使用GD函數切正方形圖像

PHP使用GD函數切正方形圖...

基本上大都是等比例將圖片上傳.... 但有時也會有需要正方形邊長的圖像需求 這時候還是得靠GD函式了...

邁進6個月

邁進6個月

s 兒子在Mandy肚子裡邁入個多月了~ 最近胎動的很厲害,真的辛苦了兒子的媽~ 每天隔著肚皮跟他說...

麻油雞泡飯

麻油雞泡飯

再一次,又到了麻油雞酒的季節。 is sesame oil chicken season again...

一沒注意就受傷了,眉頭紅紅的(猜得到5U做了什麼好事嗎?)

一沒注意就受傷了,眉頭紅紅的...

一沒注意就受傷了,眉頭紅紅的(猜得到U做了什麼好事嗎?)

apache下設置不顯示目錄列表 Indexes FollowSymLinks

apache下設置不顯示目錄...

pexelsphoto 選擇編輯httpd.conf文件 vi conf/httpd.conf 找到...

還是Chloe魅力無敵啊~

還是Chloe魅力無敵啊~

趁著兒子午睡,悄悄的把他懷中百味雜陳的Chloe送去洗澡~ 想說要過年了,也該清潔一下了。 怎知兒子...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format