gnuplot:如何用pixmap显示透明png

问题描述 投票:0回答:1

我正在尝试使用

set pixmap
命令将图像 (png) 放置在地图顶部。

它确实有效,但 png 的透明度没有“显示”,我得到的是白色背景。

pixmap
功能可以处理图像的透明度属性吗?

这是脚本:

$DATA<<EOD
1,"Washington",630.2000,1591.1800
EOD
$DATA01<<EOD
1 "C:\\Temp\\Images\\colors.png" 630.2000 1591.1800
EOD
set datafile separator comma
set style data point
set term windows enhanced size 3000.00,2000.00
unset xtics; unset ytics; unset x2tics; unset y2tics
set grid noxtics
set grid noytics
set border 0
set colorsequence classic
set key off
set for [i=1:1] pixmap i word($DATA01[i], 2) center at word($DATA01[i], 3), word($DATA01[i], 4) width 100 height 100 
plot 'C:\Magic\XPA\46s\Add_On\ChartGenerator\Geography\USA_Curved_Names_Blue.png.jpg' binary filetype=JPG w rgbimage,\
$DATA every ::0::0 using ($3):($4) notitle,\
$DATA using ($3):($4):($2) with labels font "Tahoma,20" textcolor rgb "purple" center offset 0,1 notitle

这是png文件:

和地图文件:

罗伯托

gnuplot transparency pixmap
1个回答
0
投票

我不知道到底发生了什么,但这与图像文件本身有关。如果我在 GIMP 中打开该文件并将其导出到一个新文件而不进行任何编辑/修改操作,则导出的文件可以作为具有透明区域的像素图正常工作。

比较

identify -verbose original.png
identify -verbose redo.png
的输出并没有显示出任何对我来说很突出的内容。 GIMP 添加了一些
exif
icc
记录,但我确信 gnuplot 对这些一无所知。

我在此处附加了重新导出的文件 - 尝试用它代替原始图像文件,看看是否有效。

就其价值而言,以下是

identify
在两个文件上运行之间的差异:

diff -urp original.identify redo.identify 
--- original.identify   2023-10-25 22:38:42.002322272 -0700
+++ redo.identify       2023-10-25 22:38:57.165582322 -0700
@@ -1,5 +1,5 @@
 Image:
-  Filename: original.png
+  Filename: redo.png
   Permissions: rw-r--r--
   Format: PNG (Portable Network Graphics)
   Mime type: image/png
@@ -701,27 +701,46 @@ Image:
   Dispose: Undefined
   Iterations: 0
   Compression: Zip
-  Orientation: Undefined
+  Orientation: TopLeft
+  Profiles:
+    Profile-exif: 214 bytes
+    Profile-icc: 672 bytes
+    Profile-xmp: 3426 bytes
   Properties:
-    date:create: 2023-10-26T03:31:34+00:00
-    date:modify: 2023-10-26T03:31:34+00:00
-    date:timestamp: 2023-10-26T05:38:41+00:00
+    date:create: 2023-10-26T05:34:37+00:00
+    date:modify: 2023-10-26T05:34:37+00:00
+    date:timestamp: 2023-10-26T05:38:56+00:00
+    exif:BitsPerSample: 8, 8, 8
+    exif:ColorSpace: 1
+    exif:DateTime: 2023:10:25 22:34:25
+    exif:ExifOffset: 190
+    exif:ImageLength: 512
+    exif:ImageWidth: 512
+    exif:Software: GIMP 2.10.34
+    icc:copyright: Public Domain
+    icc:description: GIMP built-in sRGB
+    icc:manufacturer: GIMP
+    icc:model: sRGB
+    png:bKGD: chunk was found (see Background color, above)
+    png:iCCP: chunk was found
     png:IHDR.bit-depth-orig: 8
     png:IHDR.bit_depth: 8
-    png:IHDR.color-type-orig: 2
-    png:IHDR.color_type: 2 (Truecolor)
+    png:IHDR.color-type-orig: 6
+    png:IHDR.color_type: 6 (RGBA)
     png:IHDR.interlace_method: 0 (Not interlaced)
     png:IHDR.width,height: 512, 512
     png:pHYs: x_res=3780, y_res=3780, units=1
-    png:tRNS: chunk was found
+    png:text: 1 tEXt/zTXt/iTXt chunks were found
+    png:text-encoded profiles: 1 were found
+    png:tIME: 2023-10-26T05:34:37Z
     signature: cb4667f54b948708bd7fd893e4668ca843bf816392a4bad8c8917b967cf1f1ea
   Artifacts:
     verbose: true
   Tainted: False
-  Filesize: 11772B
+  Filesize: 15513B
   Number pixels: 262144
   Pixel cache type: Memory
-  Pixels per second: 23.7179MP
+  Pixels per second: 21.9381MP
   User time: 0.010u
   Elapsed time: 0:01.011
   Version: ImageMagick 7.1.1-11 Q16-HDRI x86_64 21206 https://imagemagick.org

如果您在那里发现任何相关内容,请告诉我。如果它是一个可以测试的可重现的文件属性,也许可以教 gnuplot 修复它或至少发出警告。

© www.soinside.com 2019 - 2024. All rights reserved.