用ocaml图形保存图像 [英] Save image with ocaml graphics
问题描述
我想将由ocaml图形生成的图片保存在文件(png或jpeg)中。
谢谢。
我假定您正在讨论 Graphics中
模块在ocaml中。
您应该注意到图形
模块不适用于创建和处理图像。如果你已经开始写了一些产生 Graphics.image
的东西,你当然可以调用 Graphics.dump_image
类型。这将产生一个彩色数组数组
,其中 color
是格式为0xRRGGBB的打包整数。
在其他一些转换函数之后,您应该调用 camlimages 生成您的图片,以及从另一个问题获取代码示例 。
i want to save the picture generated by ocaml graphics in a file (png or jpeg). Thank you.
I'm going to assume that you are talking about the Graphics
module in ocaml.
You should notice that the Graphics
module isn't for creating and processing images. You can of course call Graphics.dump_image
if you've already gone ahead and wrote something that produces the Graphics.image
type. This will produce a color array array
, where color
is a packed integer in the format, 0xRRGGBB.
After some other conversion functions you should call upon camlimages to produce your image, and there is a code sample from another question.
这篇关于用ocaml图形保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!