简体   繁体   English

使用ocaml图形保存图像

[英]Save image with ocaml graphics

i want to save the picture generated by ocaml graphics in a file (png or jpeg). 我想将ocaml图形生成的图片保存在文件(png或jpeg)中。 Thank you. 谢谢。

I'm going to assume that you are talking about the Graphics module in ocaml. 我假设您正在讨论ocaml中的Graphics模块。

You should notice that the Graphics module isn't for creating and processing images. 您应该注意到Graphics模块不用于创建和处理图像。 You can of course call Graphics.dump_image if you've already gone ahead and wrote something that produces the Graphics.image type. 你当然可以调用Graphics.dump_image如果你已经开始编写产生Graphics.image类型的东西。 This will produce a color array array , where color is a packed integer in the format, 0xRRGGBB. 这将生成一个color array array ,其中color是格式为0xRRGGBB的打包整数。

After some other conversion functions you should call upon camlimages to produce your image, and there is a code sample from another question . 在其他一些转换函数之后,您应该调用camlimages来生成图像,并且还有来自另一个问题的代码示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM