i need a little bit help achieving the topic and i hope you guys will help me

my task is to fetch an user avatar (.jpg) from a directory in php, convert it to a .raw file and output the result (php echo). the resulting .raw will be downloaded by an external application and will be rendered onto the screen with a game engine. before i started writing my php script i manually tested to convert the avatar ("convert avatar.jpg a.raw") and render it so i can be sure this step works. sadly it doesnt work and i think the problem is the alpha channel, cuz the image gets totally f*cked up by the engine renderer if an alpha channel is in the pic.
In photoshop i do this:
-crop the image ofc
-use 8bit per channel
-select areas for alpha channel and creating a new channel (alpha) out of it (if there is none i dont createn an alpha channel nor do i select areas)
-save the file with alpha channel unchecked and transparency checked


so how can i achieve this with imagemagick? preferably without saving it to hdd directly in a php file?
im glad about any input =)
thank you!!