Message Boards Message Boards

1
|
5034 Views
|
1 Reply
|
3 Total Likes
View groups...
Share
Share this post:

Export a PNG file with ColorMap and RawData?

Posted 6 years ago

Some database for machine learning, like VOC dataset, use .PNG file to store information. They store information in 0~255, and display it by using ColorMap.

I import it by using this code:

data=Import[path, "RawData"]
cmap=Import[path, "ColorMap"]

But I cannot find a way to export a PNG file in this format. A .PNG file in this format is included.

Attachments:
POSTED BY: Zhang Yanbo

http://reference.wolfram.com/language/ref/format/PNG.html

The first example in ImportElements -> Data Representation -> "ColorMap" section shows how to generate a PNG image with a color-reduction palette.

data = Import[path, "RawData"]
cmap = Import[path, "ColorMap"]
Export["palette.png", {"ColorMap"->cmap, "RawData"->data}, "Rules"] 

This syntax is supported also for GIF and TIFF.

POSTED BY: Piotr Wendykier
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract