• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit Search
0

iterate and look at pixels

New Here ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

Hi,

i'm trying to do something that should be really really simple - write a plugin that iterates over all the pixels of the current frame and outputs the values (pixel coordinates, rbg + alpha) to the file. However, some of the lines in the file that I'm getting are quite strange-looking - there's some duplicates, some lines don't make sense at all (they have too many or few values) etc etc.

 

here's the relevant snippet

static PF_Err 
Render (
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*outputP)
{
    PF_Err 				err = PF_Err_NONE;
    AEGP_SuiteHandler	suites(in_data->pica_basicP);
    PF_EffectWorld		*inputP 		= &params[0]->u.ld;
    PF_Pixel8			*bop_outP		= 	outputP->data,
				*bop_inP		= 	inputP->data;

    std::string curtime = std::to_string(in_data->current_time);
    std::ofstream outfile("C:/somepath/" + curtime + ".txt");
    outfile << "size " << inputP->height << " " << inputP->width << "\n";
    outfile << "x   y   R   G   B   A \n";


    for (A_long yL = 0; yL < inputP->height; yL++) {
        for (A_long xL = 0; xL < inputP->width; xL++) {
            outfile << (int) yL << "  " << (int) xl << "  "
                    << (int) bop_inP->red << "   "
                    << (int) bop_inP->green << "   "
                    << (int) bop_inP->blue << "   "
                    << (int) bop_inP->alpha << "\n";
            *bop_outP++ = *bop_inP++;
        }
    }

    return err;
}

 

 

Any ideas why that might be happening ?

 

TOPICS
SDK

Views

60

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Feb 02, 2023 Feb 02, 2023

I don't see any usage of rowbytes, in [above]; there could be variance at the end of each row.

I'd recommend avoiding such vagaries, by using the iteration callback functions as defined in AE_EffectCB.h, in the After Effects SDK; the Gamma_Table, SDK_Noise, and Custom_ECW_UI samples use them.


Votes

Translate

Translate
Adobe Employee ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

LATEST

I don't see any usage of rowbytes, in [above]; there could be variance at the end of each row.

I'd recommend avoiding such vagaries, by using the iteration callback functions as defined in AE_EffectCB.h, in the After Effects SDK; the Gamma_Table, SDK_Noise, and Custom_ECW_UI samples use them.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines