2011-08-17 69 views
1

我需要知道是否有任何可用的PHP方法,通過它我可以在300ppi中創建圖像?我看到GD庫的文檔,但找不到任何信息。有沒有什麼方法可以處理圖像並設置ppi?如何在php中創建300ppi圖片?

或者,有什麼方法可以在Flash中轉換圖像分辨率?

感謝

瑪尼

+2

好像調整大小是你在GD唯一的選擇。看看這個在PHP.net上的評論。 Imagick的PHP可能是要走的路:http://www.php.net/manual/en/function.imagick-setresolution.php#95533 –

回答

2

這裏的樣本代碼,你可以使用:

imagejpeg($image, $file, 75); 

// Change DPI 
$dpi_x = 300; 
$dpi_y = 300; 

$image = file_get_contents($file); 

// Update DPI information in the JPG header 
$image[13] = chr(1); 
$image[14] = chr(floor($dpi_x/255)); 
$image[15] = chr($dpi_x%255); 
$image[16] = chr(floor($dpi_y/255)); 
$image[17] = chr($dpi_y%255); 

// Write the new JPG 
file_put_contents($file, $msg); 
+0

感謝您的答案,我會嘗試它。我不會忘記接受答案,那麼它的工作:) –