当合并两个PNG图像时,如何保留ImageMagick自定义调色板?

6
我需要合并两个PNG图像,使用16种颜色的调色板,保持原始颜色编号和顺序。
这两个PNG图像使用相同的16种颜色调色板。
有一种方法可以创建4位索引PNG,其中包含所有颜色,按照确切的顺序排列,即使每个PNG中未使用?
编辑以更清晰明了:我有两张图片。第一张是“level-000.png”:
它被标识为:
Image: level-000.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: PseudoClass
  Geometry: 144x144+0+0
  Resolution: 28.35x28.35
  Print size: 5.07937x5.07937
  Units: PixelsPerCentimeter
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 20736
    Red:
      min: 0 (0)
      max: 184 (0.721569)
      mean: 88.6151 (0.34751)
      standard deviation: 27.9329 (0.109541)
      kurtosis: 1.7675
      skewness: 0.143857
    Green:
      min: 0 (0)
      max: 199 (0.780392)
      mean: 68.8957 (0.270179)
      standard deviation: 22.7411 (0.0891808)
      kurtosis: 18.2722
      skewness: 2.87959
    Blue:
      min: 0 (0)
      max: 111 (0.435294)
      mean: 19.4671 (0.0763416)
      standard deviation: 22.1775 (0.0869706)
      kurtosis: 2.80475
      skewness: 1.17593
  Image statistics:
    Overall:
      min: 0 (0)
      max: 199 (0.780392)
      mean: 58.9926 (0.231344)
      standard deviation: 24.4216 (0.095771)
      kurtosis: 17.5446
      skewness: 0.948025
  Colors: 4
  Histogram:
       390: (  0,  0,  0) #000000 black
     10196: ( 67, 57,  0) #433900 srgb(67,57,0)
      9770: (111, 79, 37) #6F4F25 srgb(111,79,37)
       380: (184,199,111) #B8C76F srgb(184,199,111)
  Colormap entries: 16
  Colormap:
         0: (  0,  0,  0) #000000 black
         1: (255,255,255) #FFFFFF white
         2: (104, 55, 43) #68372B srgb(104,55,43)
         3: (112,164,178) #70A4B2 srgb(112,164,178)
         4: (111, 61,134) #6F3D86 srgb(111,61,134)
         5: ( 88,141, 67) #588D43 srgb(88,141,67)
         6: ( 53, 40,121) #352879 srgb(53,40,121)
         7: (184,199,111) #B8C76F srgb(184,199,111)
         8: (111, 79, 37) #6F4F25 srgb(111,79,37)
         9: ( 67, 57,  0) #433900 srgb(67,57,0)
        10: (154,103, 89) #9A6759 srgb(154,103,89)
        11: ( 68, 68, 68) #444444 srgb(68,68,68)
        12: (108,108,108) #6C6C6C srgb(108,108,108)
        13: (154,210,132) #9AD284 srgb(154,210,132)
        14: (108, 94,181) #6C5EB5 srgb(108,94,181)
        15: (149,149,149) #959595 srgb(149,149,149)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: black
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 144x144+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-04-10T12:24:18+02:00
    date:modify: 2015-04-09T22:33:29+02:00
    png:bKGD: chunk was found (see Background color, above)
    png:IHDR.bit-depth-orig: 4
    png:IHDR.bit_depth: 4
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 144, 144
    png:pHYs: x_res=2835, y_res=2835, units=1
    png:PLTE.number_colors: 16
    png:sRGB: intent=0 (Perceptual Intent)
    signature: 00d9489d55480d588c3329ab0fa844ed2a67eea06fd4dfa793503a36f9c4b160
  Artifacts:
    filename: level-000.png
    verbose: true
  Tainted: False
  Filesize: 337B
  Number pixels: 20.7K
  Pixels per second: 0B
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.8.9-8 Q16 x86_64 2014-11-18

第二张图片是“scacchiera.png”。 scacchiera.png 它被认定为:
Image: scacchiera.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: PseudoClass
  Geometry: 144x144+0+0
  Resolution: 28.35x28.35
  Print size: 5.07937x5.07937
  Units: PixelsPerCentimeter
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 20736
    Red:
      min: 67 (0.262745)
      max: 111 (0.435294)
      mean: 89 (0.34902)
      standard deviation: 22 (0.0862745)
      kurtosis: -2
      skewness: -1.18433e-11
    Green:
      min: 57 (0.223529)
      max: 79 (0.309804)
      mean: 68 (0.266667)
      standard deviation: 11 (0.0431373)
      kurtosis: -2
      skewness: 7.03683e-11
    Blue:
      min: 0 (0)
      max: 37 (0.145098)
      mean: 18.5 (0.072549)
      standard deviation: 18.5 (0.072549)
      kurtosis: -2
      skewness: 0
  Image statistics:
    Overall:
      min: 0 (0)
      max: 111 (0.435294)
      mean: 58.5 (0.229412)
      standard deviation: 17.7694 (0.0696837)
      kurtosis: 29.9398
      skewness: -1.66976
  Colors: 2
  Histogram:
     10368: ( 67, 57,  0) #433900 srgb(67,57,0)
     10368: (111, 79, 37) #6F4F25 srgb(111,79,37)
  Colormap entries: 16
  Colormap:
         0: (  0,  0,  0) #000000 black
         1: (255,255,255) #FFFFFF white
         2: (104, 55, 43) #68372B srgb(104,55,43)
         3: (112,164,178) #70A4B2 srgb(112,164,178)
         4: (111, 61,134) #6F3D86 srgb(111,61,134)
         5: ( 88,141, 67) #588D43 srgb(88,141,67)
         6: ( 53, 40,121) #352879 srgb(53,40,121)
         7: (184,199,111) #B8C76F srgb(184,199,111)
         8: (111, 79, 37) #6F4F25 srgb(111,79,37)
         9: ( 67, 57,  0) #433900 srgb(67,57,0)
        10: (154,103, 89) #9A6759 srgb(154,103,89)
        11: ( 68, 68, 68) #444444 srgb(68,68,68)
        12: (108,108,108) #6C6C6C srgb(108,108,108)
        13: (154,210,132) #9AD284 srgb(154,210,132)
        14: (108, 94,181) #6C5EB5 srgb(108,94,181)
        15: (149,149,149) #959595 srgb(149,149,149)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 144x144+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-04-10T20:46:55+02:00
    date:modify: 2015-04-10T20:46:55+02:00
    png:IHDR.bit-depth-orig: 4
    png:IHDR.bit_depth: 4
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 144, 144
    png:pHYs: x_res=2835, y_res=2835, units=1
    png:PLTE.number_colors: 16
    png:sRGB: intent=0 (Perceptual Intent)
    signature: 8a0ca53e6e6f8e8fc4b141c7194b399ed1fc32473b174b6240addbb3f98864e5
  Artifacts:
    filename: scacchiera.png
    verbose: true
  Tainted: False
  Filesize: 241B
  Number pixels: 20.7K
  Pixels per second: 0B
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.8.9-8 Q16 x86_64 2014-11-18

如您所见,这两张图片的颜色是相同的:

  Colormap entries: 16
  Colormap:
         0: (  0,  0,  0) #000000 black
         1: (255,255,255) #FFFFFF white
         2: (104, 55, 43) #68372B srgb(104,55,43)
         3: (112,164,178) #70A4B2 srgb(112,164,178)
         4: (111, 61,134) #6F3D86 srgb(111,61,134)
         5: ( 88,141, 67) #588D43 srgb(88,141,67)
         6: ( 53, 40,121) #352879 srgb(53,40,121)
         7: (184,199,111) #B8C76F srgb(184,199,111)
         8: (111, 79, 37) #6F4F25 srgb(111,79,37)
         9: ( 67, 57,  0) #433900 srgb(67,57,0)
        10: (154,103, 89) #9A6759 srgb(154,103,89)
        11: ( 68, 68, 68) #444444 srgb(68,68,68)
        12: (108,108,108) #6C6C6C srgb(108,108,108)
        13: (154,210,132) #9AD284 srgb(154,210,132)
        14: (108, 94,181) #6C5EB5 srgb(108,94,181)
        15: (149,149,149) #959595 srgb(149,149,149)

如果我将它们连接起来
convert -page 312x144+0+0 "scacchiera.png" -page +168+0 \
   "level-000.png" -background black -layers flatten "joined.png" 

接下来的"joined.png"图片是:

joined.png

它被识别为:

Image: joined.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: PseudoClass
  Geometry: 312x144+0+0
  Resolution: 28.35x28.35
  Print size: 11.0053x5.07937
  Units: PixelsPerCentimeter
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 44928
    Red:
      min: 0 (0)
      max: 184 (0.721569)
      mean: 81.9762 (0.321475)
      standard deviation: 33.8163 (0.132613)
      kurtosis: 0.917842
      skewness: -0.743586
    Green:
      min: 0 (0)
      max: 199 (0.780392)
      mean: 63.1826 (0.247775)
      standard deviation: 25.0478 (0.0982265)
      kurtosis: 7.85041
      skewness: 0.0804364
    Blue:
      min: 0 (0)
      max: 111 (0.435294)
      mean: 17.5233 (0.0687188)
      standard deviation: 20.2675 (0.0794802)
      kurtosis: 1.51309
      skewness: 0.876441
  Image statistics:
    Overall:
      min: 0 (0)
      max: 199 (0.780392)
      mean: 54.2274 (0.212656)
      standard deviation: 26.9673 (0.105754)
      kurtosis: 7.87712
      skewness: 0.327418
  Colors: 4
  Histogram:
      3846: (  0,  0,  0) #000000 black
     20564: ( 67, 57,  0) #433900 srgb(67,57,0)
     20138: (111, 79, 37) #6F4F25 srgb(111,79,37)
       380: (184,199,111) #B8C76F srgb(184,199,111)
  Colormap entries: 4
  Colormap:
         0: ( 67, 57,  0) #433900 srgb(67,57,0)
         1: (111, 79, 37) #6F4F25 srgb(111,79,37)
         2: (  0,  0,  0) #000000 black
         3: (184,199,111) #B8C76F srgb(184,199,111)
  Rendering intent: Perceptual
  Gamma: 0.45455
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: black
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 312x144+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-04-12T15:13:11+02:00
    date:modify: 2015-04-12T15:13:11+02:00
    png:bKGD: chunk was found (see Background color, above)
    png:cHRM: chunk was found (see Chromaticity, above)
    png:gAMA: gamma=0.45454544 (See Gamma, above)
    png:IHDR.bit-depth-orig: 2
    png:IHDR.bit_depth: 2
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 312, 144
    png:pHYs: x_res=2835, y_res=2835, units=1
    png:PLTE.number_colors: 4
    png:sRGB: intent=0 (Perceptual Intent)
    png:text: 2 tEXt/zTXt/iTXt chunks were found
    signature: 2049a10c0a2a73f864125d0ba93ccfc604a750667e3ba1d0fe8fe3be38a1cbea
  Artifacts:
    filename: joined.png
    verbose: true
  Tainted: False
  Filesize: 487B
  Number pixels: 44.9K
  Pixels per second: 4.493MB
  User time: 0.000u
  Elapsed time: 0:01.009
  Version: ImageMagick 6.8.9-8 Q16 x86_64 2014-11-18

您可以看到,调色板与初始的完全不同。

这里有图片:

问题是:是否有一种方法始终使用该调色板:

  Colormap entries: 16
  Colormap:
         0: (  0,  0,  0) #000000 black
         1: (255,255,255) #FFFFFF white
         2: (104, 55, 43) #68372B srgb(104,55,43)
         3: (112,164,178) #70A4B2 srgb(112,164,178)
         4: (111, 61,134) #6F3D86 srgb(111,61,134)
         5: ( 88,141, 67) #588D43 srgb(88,141,67)
         6: ( 53, 40,121) #352879 srgb(53,40,121)
         7: (184,199,111) #B8C76F srgb(184,199,111)
         8: (111, 79, 37) #6F4F25 srgb(111,79,37)
         9: ( 67, 57,  0) #433900 srgb(67,57,0)
        10: (154,103, 89) #9A6759 srgb(154,103,89)
        11: ( 68, 68, 68) #444444 srgb(68,68,68)
        12: (108,108,108) #6C6C6C srgb(108,108,108)
        13: (154,210,132) #9AD284 srgb(154,210,132)
        14: (108, 94,181) #6C5EB5 srgb(108,94,181)
        15: (149,149,149) #959595 srgb(149,149,149)

请确认是否按照这16种颜色以及顺序生成每个PNG文件?


我对你为什么要这样做感到好奇 - 如果我们知道原因,可能会有另一种解决方法。 - Mark Setchell
1
我需要这些颜色,因为这些图像将在一台8位计算机上使用,使用固定的调色板,并按照精确的顺序排列。 将所有数据放置在正确的顺序中会使事情变得更容易... (如果需要添加其他图形等...) - Flavio Pasqualin
2个回答

2
我进一步研究了这个问题,相信我可以实现你想要的功能...基本上,我允许ImageMagick按照你的要求重新分页和合并图像,但然后我让ImageMagick以便携式任意映射PNM格式输出一个NetPBM文件。然后,我使用我编写的Perl编码器将PNM格式文件编码为PNG,以匹配你对调色板的非常特定的需求。因此,对于我从PNM文件中读取的每个真彩24位RGB像素,我通过计算平方误差之和来确定它最接近哪个调色板条目,然后输出单个调色板索引。 NetPBM的描述在这里PNM格式非常简单易懂,这就是我选择它的原因。它在这里有描述。
因此,您的原始命令几乎相同,只是会在stdout输出一个PNM文件,并被Perl脚本pnmtopng读取,然后生成您想要的PNG文件:
convert -page 312x144+0+0 scacchiera.png -page +168+0 \
   level-000.png -background black -layers flatten pnm:- |  ./pnmtopng > out.png

这里是Perl脚本:
#!/usr/bin/perl
use strict;
use warnings;
use Digest::CRC qw(crc32);
use IO::Compress::Deflate qw(deflate $DeflateError) ;

# Our beloved fixed palette
my @palette=(
      [0,0,0],
      [255,255,255],
      [104,55,43],
      [112,164,178],
      [111,61,134],
      [88,141,67],
      [53,40,121],
      [184,199,111],
      [111,79,37],
      [67,57,0],
      [154,103,89],
      [68,68,68],
      [108,108,108],
      [154,210,132],
      [108,94,181],
      [149,149,149]
   );

################################################################################
# Take chunk of PNG data as parameter, calculate its length & CRC, and output it
################################################################################
sub PNGoutputChunk()
{
   my $len=length($_[0])-4;
   my $crc = Digest::CRC->new(type=>"crc32");
   $crc->add($_[0]);
   print pack('N',$len),$_[0],pack('N',$crc->digest);
}

################################################################################
# Main
################################################################################

   # Read P6 PNM file from STDIN
   my $line = <STDIN>;
   chomp($line);
   if ($line ne "P6"){die "Expected P6 format PNM file"}

   # Read width and height from STDIN
   $line = <STDIN>;
   my ($width,$height) = ($line =~ /(\d+)\s+(\d+)/); 
   print STDERR "DEBUG: width=$width, height=$height\n";

   # Read MAX PNM value and ignore
   $line = <STDIN>;

   # Read entire remainder of PNM file
   my $expectedsize=$width * $height * 3;
   my $PNMdata;
   my $bytesRead = read(STDIN,$PNMdata,$expectedsize);
   if($bytesRead != $expectedsize){die "Unable to read PNM data"}

   # Output PNG header chunk
   printf "\x89PNG\x0d\x0a\x1a\x0a";

   my $bitdepth=8;
   my $colortype=3;
   my $compressiontype=0;
   my $filtertype=0;
   my $interlacetype=0;

   # Output PNG IHDR chunk
   my $IHDR='IHDR';
   $IHDR .= pack 'N',$width;
   $IHDR .= pack 'N',$height;
   $IHDR .= pack 'c',$bitdepth;
   $IHDR .= pack 'c',$colortype;
   $IHDR .= pack 'c',$compressiontype;
   $IHDR .= pack 'c',$filtertype;
   $IHDR .= pack 'c',$interlacetype;
   &PNGoutputChunk($IHDR);

   # Output PNG PLTE (palette)
   my $PLTE='PLTE';
   for(my $i=0;$i<scalar @palette;$i++){
      $PLTE .= sprintf('%c',$palette[$i][0]); # Red
      $PLTE .= sprintf('%c',$palette[$i][1]); # Green
      $PLTE .= sprintf('%c',$palette[$i][2]); # Blue
   }
   &PNGoutputChunk($PLTE);

   # Output PNG IDAT chunk
   # RFC-1950 zlib compression
   my $raw;
   # Go through PNM data, and for each RGB pixel, find nearest palette entry
   my @PNMvalues = unpack("C*",$PNMdata);
   print STDERR "Unpacked ",scalar @PNMvalues," from raw\n";
   for(my $pixel=0;$pixel<(scalar @PNMvalues)/3;$pixel++){

      # Output filter type byte (0) at start of each scanline
      if($pixel%$width==0){$raw .= "\x00";}

      my $r=$PNMvalues[(3*$pixel)];   # Red PNM value
      my $g=$PNMvalues[(3*$pixel)+1]; # Green PNM value
      my $b=$PNMvalues[(3*$pixel)+2]; # Blue PNM value
      my $nearest=0;
      my $distmin=(255*255)+(255*255)+(255*255); # Couldn't get further
      # Go through all palette entries to find nearest to this RGB
      for(my $pe=0;$pe<scalar @palette;$pe++){
         my $pr=$palette[$pe][0];   # Red palette value
         my $pg=$palette[$pe][1]; # Green palette value
         my $pb=$palette[$pe][2]; # Blue palette value
         my $dist = ($pr-$r)*($pr-$r) + ($pg-$g)*($pg-$g) + ($pb-$b)*($pb-$b);
         if($dist<$distmin){
            $distmin=$dist;
            $nearest=$pe;
         }
      }
      $raw .= sprintf "%c",$nearest;
      print STDERR "Pixel: $pixel, r=$r, g=$g, b=$b. Chose palette entry $nearest\n";
   }
   print STDERR "Length of raw: ",length($raw);

   my $deflated;
   my $status = deflate \$raw => \$deflated
        or die "deflate failed: $DeflateError\n";

   my $IDAT="IDAT" . $deflated;
   &PNGoutputChunk($IDAT);

   # Output PNG IEND chunk
   &PNGoutputChunk('IEND');

结果是这样的:

enter image description here


似乎在我的系统上不起作用,或者我漏掉了什么。
  • 文件“pnmtopng.pl”已创建并+ x。
  • 使用“convert -page 312x144 +0 +0 scacchiera.png -page +168 +0 level-000.png -background black -layers flatten pnm:- | ./pnmtopng.pl out.png”进行测试,但我收到错误消息,如“在./pnmtopng.pl第111行中的减法(-)中未初始化值$ pb,在<STDIN>第3行。”。 最终的颜色映射看起来像“0:(0,0,0)#000000黑色,1:(255,0,0)#FF0000红色,2:(104,0,0)#680000 srgb(104,0,0)”。我正在使用OpenSuse 13.2。
- Flavio Pasqualin
哦,非常抱歉。请再试一次——我不知道发生了什么事情,因为脚本看起来是损坏的。我已经重新粘贴了它。 - Mark Setchell
您可以安全地删除所有调试打印到 STDERR,或在结尾处运行 2> /dev/null - Mark Setchell
不错!现在正常工作了。如果没有“本地”解决方案可用,这肯定是一个可行的解决方案!谢谢! - Flavio Pasqualin
太好了!我非常满意,因为我昨天甚至还没有看过PNG规范 :-) - Mark Setchell

1

我已经尝试了很多次,但是我无法使用ImageMagick完成这个任务。您可以像这样从scacchiera.png中提取唯一的颜色:

convert scacchiera.png -unique-colors -scale 1000 swatch.png

但是那里只有两种颜色,所以那没什么用处:

enter image description here

您还可以提取颜色映射表,并像这样创建调色板:

convert xc:"#000000" xc:"#FFFFFF" xc:"#68372B" xc:"#70A4B2" \
        xc:"#6F3D86" xc:"#588D43" xc:"#352879" xc:"#B8C76F" \
        xc:"#6F4F25" xc:"#433900" xc:"#9A6759" xc:"#444444" \
        xc:"#6C6C6C" xc:"#9AD284" xc:"#6C5EB5" xc:"#959595" +append -scale 500 clut.png

这是什么意思?需要翻译哪些部分?

enter image description here

你可以像这样使用该颜色查找表(CLUT),但它并没有帮助。
convert -page 312x144+0+0 "scacchiera.png" -page +168+0      \
"level-000.png" -background black -layers flatten             \
-remap clut.png "joined.png"  

您可以像这样使用它,但那也不起作用。
convert -page 312x144+0+0 "scacchiera.png" -page +168+0   \
        "level-000.png" -background black -layers flatten \
        clut.png -clut "joined.png" 

您也可以尝试告诉ImageMagick保留颜色映射表,但我会让您猜测它是否有效 :-(
convert -define png:preserve-colormap scacchiera.png ...
convert -define png:preserve-colormap=1 scacchiera.png png00:out.png
convert -define png:preserve-colormap=true scacchiera.png png00:out.png

所以,我也卡住了 :-)

原始答案

您没有说明您想如何合并您的图像,也没有提供任何图像,也没有展示您尝试过什么,因此您可能无法得到一个好的答案。不过,以下或许会接近您的需求...

convert 1.png 2.png -append -remap 1.png result.png

据我所知,这个“问题”与imagemagick在转换过程中优化调色板的方式有关。它只按某种顺序放置已使用的颜色... 我想我需要在调色板上“禁用”“优化”(量化/抖动/是什么),也许-强制-我的颜色... 但我无法想象如何做到这一点(以及这是否是正确的方法...) 只是说:如果您尝试将“clut.png”转换为您想要的格式,则最终颜色顺序会改变... - Flavio Pasqualin
也许@GlennRanders-Pehrson会看一下并提供一些见解-我相信他写了IM PNG编码器... - Mark Setchell
@MarkSetchell:Glenn 也于1998年共同撰写了PNG规范v1.1 :-) - Kurt Pfeifle
@KurtPfeifle 哦,太棒了,谢谢。我不知道这个 - 我会把它添加到我不知道的巨大清单中 :-) - Mark Setchell
@MarkSetchell:还想了解更多吗?Glenn也是libpng和pngcrush的作者 :-) - Kurt Pfeifle

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接