<commit_before>//! Functions for altering and converting the color of pixelbufs

use num_traits::{Num, NumCast};
use std::f64::consts::PI;

use crate::color::{Luma, Rgba};
use crate::image::{GenericImage, GenericImageView};
use crate::math::nq;
use crate::math::utils::clamp;
use crate::traits::{Pixel, Primitive};
use crate::ImageBuffer;

type Subpixel<I> = <<I as GenericImageView>::Pixel as Pixel>::Subpixel;

/// Convert the supplied image to grayscale
pub fn grayscale<I: GenericImageView>(image: &I) -> ImageBuffer<Luma<Subpixel<I>>, Vec<Subpixel<I>>>
where
    Subpixel<I>: 'static,
    <Subpixel<I> as Num>::FromStrRadixErr: 'static,
{<commit_msg>Annotate the use sites with #[allow(deprecated)]<commit_after>//! Functions for altering and converting the color of pixelbufs

use num_traits::{Num, NumCast};
use std::f64::consts::PI;

use crate::color::{Luma, Rgba};
use crate::image::{GenericImage, GenericImageView};
#[allow(deprecated)]
use crate::math::nq;
use crate::math::utils::clamp;
use crate::traits::{Pixel, Primitive};
use crate::ImageBuffer;

type Subpixel<I> = <<I as GenericImageView>::Pixel as Pixel>::Subpixel;

/// Convert the supplied image to grayscale
pub fn grayscale<I: GenericImageView>(image: &I) -> ImageBuffer<Luma<Subpixel<I>>, Vec<Subpixel<I>>>
where
    Subpixel<I>: 'static,
    <Subpixel<I> as Num>::FromStrRadixErr: 'static,
{
{'fraction_non_alphanumeric': 0.16544655929721816, 'fraction_numerical': 0.0029282576866764276, 'mean_word_length': 7.386503067484663, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4087464', 'n_tokens_mistral': 468, 'n_tokens_neox': 453, 'n_words': 120}