MoonBit module to parse International Color Consortium (ICC) profiles.
Dependencies
moon update
moon add enanandesu/icc| Function | Description |
|---|---|
| parse(path) | Backwards-compatible alias for parse_from_file. |
| parse_from_file(path) | Read an ICC file from disk and return metadata. |
| parse_from_bytes(bytes) | Parse an ICC profile represented as Bytes. |
| parse_from_buffer(buffer) | Parse ICC data already staged in @buffer.Buffer. |
| parse_from_string(text) | Parse ICC bytes carried inside a String; every UTF-16 code unit must match the original byte. |
let profile = @enanandesu/icc.parse_from_file("./test/sRGB_IEC61966-2-1_black_scaled.icc")
inspect(profile.get_or_default("colorSpace", ""), content="RGB")let bytes = @fs.read_file_to_bytes("./test/sRGB_ICC_v4_Appearance.icc")
let profile = @enanandesu/icc.parse_from_bytes(bytes)
inspect(profile.get_or_default("version", ""), content="4.3.0")let bytes = @fs.read_file_to_bytes("./test/D65_XYZ.icc")
let buf = @buffer.new(size_hint=bytes.length())
buf.write_bytes(bytes)
let profile = @enanandesu/icc.parse_from_buffer(buf)
inspect(profile.get_or_default("creator", ""), content="none")let bytes = @fs.read_file_to_bytes("./test/D65_XYZ.icc")
let text = bytes.to_unchecked_string() // UTF-16 code units equal to raw bytes
let profile = @enanandesu/icc.parse_from_string(text)
inspect(profile.get_or_default("creator", ""), content="none")Note: parse_from_string expects the string to store the original ICC bytes in its UTF-16 code units. Supplying a normal UTF-8 string (for example, "Hello UTF-8 text!") will cause parsing to fail with ParseError.
// Assuming you have ICC profile data as a buffer
let icc_data_buffer = @buffer.new() // Your ICC profile data as buffer
let profile_data = @enanandesu/icc.parse_from_buffer(icc_data_buffer)
inspect(profile_data.get_or_default("colorSpace", ""), content="RGB")// Assuming you have ICC profile data as bytes
let icc_bytes = b"..." // Your ICC profile data as bytes
let profile_data = @enanandesu/icc.parse_from_bytes(icc_bytes)
inspect(profile_data.get_or_default("colorSpace", ""), content="RGB") let profile_data = @enanandesu/icc.parse_from_file("./test/sRGB_IEC61966-2-1_black_scaled.icc")
inspect(profile_data.get_or_default("colorSpace", ""), content="RGB")
inspect(profile_data.get_or_default("creator", ""), content="")Install
Download zipMoonBit module to parse International Color Consortium (ICC) profiles.
Dependencies