我目前正在嘗試將影像轉換為 PHP 的 gdImage 物件,以便在將其顯示在網站上之前對其進行裁剪和調整大小。
這是用于演示問題的 php 的簡化版本。
$src_image = imagecreatefromjpeg('./original.jpg');
imagejpeg($src_image, './copy.jpg', 100);
它只是轉換為 php 物件并將其重新寫入檔案
這是一個失去質量的示例影像 https://s4.chorus-mk.thirdlight.com/file/24/VqvaOZDVqqaDrJ_VqtRlVzq4gcw/width=1140/height=1140/format=JPG/fit=stretch/crop=1228x0 4912x4912 /rev=1/EV2021BPCP_RM_Members Bar_0112.jpg
任何人都可以提出發生這種情況的原因嗎?
uj5u.com熱心網友回復:
您的影像包含 ICC 顏色組態檔。您可以使用ImageMagick看到:
magick identify -verbose YOURIMAGE
或exiftool像這樣:
exiftool YOURIMAGE
ExifTool Version Number : 12.30
File Name : EV2021BPCP_RM_Members Bar_0112.jpg
Directory : .
File Size : 296 KiB
File Modification Date/Time : 2022:03:02 15:47:47 00:00
File Access Date/Time : 2022:03:02 15:50:03 00:00
File Inode Change Date/Time : 2022:03:02 15:49:37 00:00
File Permissions : -rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.01
Resolution Unit : inches
X Resolution : 300
Y Resolution : 300
Profile CMM Type : Little CMS
Profile Version : 2.3.0
Profile Class : Display Device Profile
Color Space Data : RGB
Profile Connection Space : XYZ
Profile Date Time : 2008:01:10 15:30:40
Profile File Signature : acsp
Primary Platform : Microsoft Corporation
CMM Flags : Not Embedded, Independent
Device Manufacturer : Little CMS
Device Model :
Device Attributes : Reflective, Glossy, Positive, Color
Rendering Intent : Perceptual
Connection Space Illuminant : 0.9642 1 0.82491
Profile Creator : Little CMS
Profile ID : 0
Device Mfg Desc : little cms
Profile Description : ProPhoto
Device Model Desc : ProPhoto
Media White Point : 0.96396 1 0.82414
Red Matrix Column : 0.79752 0.28799 2e-05
Blue Matrix Column : 0.03143 0.00012 0.82494
Green Matrix Column : 0.13525 0.71188 -3e-05
Red Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
Green Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
Blue Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
Chromaticity Channels : 3
Chromaticity Colorant : Unknown (0)
Chromaticity Channel 1 : 0.7347 0.2653
Chromaticity Channel 2 : 0.15961 0.84039
Chromaticity Channel 3 : 0.03661 0.00011
Profile Copyright : Copyright (c) 2008, Sandy McGuffog. Some rights reserved..This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Media Black Point : 0 0 0
Image Width : 1140
Image Height : 1140
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Image Size : 1140x1140
Megapixels : 1.3
我建議您使用可以為您保留組態檔的庫,例如ImageMagick或vips.
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/436546.html
