File Exchange

image thumbnail

Fill corners of rotated image

version 1.5 (3.33 KB) by Vlad Atanasiu
Rotate image without making black edges.


Updated 19 Nov 2014

View Version History

View License

ROIROTATE was designed to avoid the 'black corners' typical of MATLAB's imrotate function, which are apearing from its behaviour of padding by zeros of the space outside the image borders prior to the rotation. This is possible if the image to be rotated is part of a bigger image, because there is enough information to fill the corners.

Cite As

Vlad Atanasiu (2020). Fill corners of rotated image (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

shadi AL amoudi

Hello,i run the code , but i got the Error message (Out of memory. The likely cause is an infinite recursion within the program) . could you please let me know how i can resolve this issue.

Thank you..


amir yavari

great job tnx

Mohsen Jamali

thanks a lot

Husam Aldahiyat

Vlad Atanasiu

Bug removed. Thanks Mathew!


Great, but there is one small but important bug! When calculating the padding, it doesn't convert from degrees to radians, which means that occasionally it will not pad the images enough. Just make sure you edit the padX and padY variables and it will work beautifully!

Elwyn Jenkins


MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!