This issue originally started on a forum post. https://dev.lucee.org/t/image-rotate/5374/4
We thought we had this resolved but I was informed that there were still issues with the image rotate functionality. I was provide with a couple of images that were acting up when we tried to rotate right (i.e. 90 degrees) despite the fact that I had the fix in place. I spent some time trying to figure out why some images worked fine and some didn’t, trying .png files instead of .jpg and then larger files rather than smaller but it all seemed rather random. Finally I noticed that the images that were throwing the exception had one thing in common, the dimensions that were not even.
To test my hunch I went to the Lucee documentation on image rotate since they had code that you could run. I modified the code on that page to create an image that is 100x99 rather than 100x100 and then ran it with rotation angles of 270 (rotate left) and 90 (rotate right) and sure enough the rotate right throws the exception. I’ve provided the link and screen shots of each below.
I also tried this:
When this happens it throws an error;
java.lang.ArrayIndexOutOfBoundsException You can try this yourself here.
My issue is that some of our users may not upload a perfectly dimensioned image. And it seems that only Odd numbers have the issue. If you change to an even number the image rotates fine.
This also effects the latest version of Lucee
Version Lucee 18.104.22.168
Version Name Velvet
Release date Sep 17, 2018
ColdFusion® compatibility version 2016.0.03.300357
OS Windows Server 2016 (10.0) 64bit
Servlet Container Apache Tomcat/8.5.28
Java 1.8.0_191 (Oracle Corporation) 64bit