是否可以旋转在PHP中保存为BLOB的图像 - 而不使用imagerotate?

When I retrieve a blob (an image) from the database, is there any way to rotate this image in PHP without imagerotate()?

Can this be done on the binary level? Like switching positions of all pixels?

Is there a shorter way than creating a temporary image and calling imagerotate()?

Thinking of JPG and PNG ... they are compressed... maybe then it is not possible? However, it might work for BMP.


Just for information, this is how I do the rotation of the blob image if JPG currently:

$degrees = -90;
$source_image = imagecreatefromstring($blob['content']);
$rotate_image = imagerotate($source_image, $degrees, 0);
ob_start();
imagejpeg($rotate_image, null, 100);
$image_bin = ob_get_contents();
ob_end_clean(); 

qa_db_query_sub( 'UPDATE blobs SET content=$ 
                    WHERE blobid=#', $image_bin, $rotateBlobId );

// free the memory
imagedestroy($source_image);
imagedestroy($rotate_image);