Rotating a program drawn image on screen

Is it possible to create a SPRITE in code and then rotate it etc?
I noticed that "sprite trails" contains the drawn image.
I was able to assign it as a costume and manipulate the temporary result.
But I could not make a new permanent sprite or costume out of it.
Thx.

Sure. Load the "pixels" library, which has blocks to capture an image and make a costume out of it. (I think you mean create a costume in code, right?)

I was able to create the costume in code with PIXELS lib.
I was trying to save the costume as a permanent image. But the SHOW PICTURE block will not display the list of pixels. I get this error:
image
myCostume is my new costume, and PIXELS OF COSTUME is a LIST of 32400 pixels of my pentrails drawing:
image
currentCostume at the time of command execution is another costume of 5x5 pixels:
image
So, to my understanding ,SHOW PICTURE is supposed to replace the black dot with the blue radial lines.

Ah. Apparently this feature is a little more fragile than I thought. It's designed so that the new costume has to have the same dimensions as the old one. Read the code and the help text of SHOW PICTURE. I'll look into this and get back to you.

I tried it with code that generates two identical costumes. The only difference was color, so I could tell the replacement had worked. And that did work.
I could switch bw code drawn costumes even with different sizes:
SMALL -> BIG displays OK
BIG -> SMALL displays distorted as below:
image

What does NOT work is when the current costume is a paint editor drawn VECTOR costume and I try to show a code drawn costume in its place. Even if the sizes are the same, it did not work. I believe this is because the "PIXELS of costume CURRENT costume" does not work if the costume is a VECTOR type.

If this is true, then maybe the PIXEL library doc could state that.

I hope you will figure it out.

Thx.

Right, the pixels library assumes the costume is in pixels. Maybe we should be able programmatically to convert. On the (long) list.