用ocaml图形保存图像 [英] Save image with ocaml graphics

查看:82
本文介绍了用ocaml图形保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将由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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆