Code Monkey home page Code Monkey logo

Comments (7)

Cykooz avatar Cykooz commented on September 24, 2024

Yes, I will make these functions.

from libheif-rs.

Cykooz avatar Cykooz commented on September 24, 2024

@sophie-h Could you get me example of heic/heif image file with NCLX color profile for testing?

from libheif-rs.

sophie-h avatar sophie-h commented on September 24, 2024

Yes, here is a .avif and .heif exported HDR (nCLX) image I have created with Krita for my testing.

https://gitlab.gnome.org/Incubator/loupe/uploads/322f81512346f3fd69b0acc502c04201/test.zip

from libheif-rs.

Cykooz avatar Cykooz commented on September 24, 2024

I have released libheif-rs 0.16.0

Example of receiving color profile:

fn test_nclx_color_profile_of_image_handle() -> Result<()> {
let ctx = HeifContext::read_from_file("./data/test_nclx.heif")?;
let handle = ctx.primary_image_handle()?;
let raw_profile = handle.color_profile_raw();
assert!(raw_profile.is_none());
let nclx_profile = handle.color_profile_nclx().unwrap();
assert_eq!(nclx_profile.profile_type(), color_profile_types::NCLX);
assert_eq!(
nclx_profile.color_primaries(),
ColorPrimaries::ITU_R_BT_2020_2_and_2100_0
);
assert_eq!(
nclx_profile.transfer_characteristics(),
TransferCharacteristics::ITU_R_BT_2100_0_PQ
);
assert_eq!(
nclx_profile.matrix_coefficients(),
MatrixCoefficients::RGB_GBR
);
assert_eq!(nclx_profile.full_range_flag(), 1);
assert_eq!(nclx_profile.color_primary_red_x(), 0.708);
assert_eq!(nclx_profile.color_primary_red_y(), 0.292);
assert_eq!(nclx_profile.color_primary_green_x(), 0.17);
assert_eq!(nclx_profile.color_primary_green_y(), 0.797);
assert_eq!(nclx_profile.color_primary_blue_x(), 0.131);
assert_eq!(nclx_profile.color_primary_blue_y(), 0.046);
assert_eq!(nclx_profile.color_primary_white_x(), 0.3127);
assert_eq!(nclx_profile.color_primary_white_y(), 0.329);
Ok(())
}

from libheif-rs.

sophie-h avatar sophie-h commented on September 24, 2024

Hey! This is working great!

I have found some minor problems during implementation:

  • Having heif_image_get_bits_per_pixel_range available for the channels would be handy.
  • The bits_pre_pixel field probably has a typo? (pre -> per)
  • Planes and Plane are not documented. Probably because they are not exported as types in lib.rs and the image module is not public

from libheif-rs.

Cykooz avatar Cykooz commented on September 24, 2024

Thank you.
Look at the new release libheif-rs 0.17.0

from libheif-rs.

sophie-h avatar sophie-h commented on September 24, 2024

Very cool. I think I got everything working now :)

from libheif-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.