12-29-2024, 09:18 AM
(12-28-2024, 10:49 PM)origamifreak2 Wrote: Thanks Ofnuts .
I've implemented most of your suggestions. The only ones I didn't are listed below with reasons why
The code is very similar, but the values inside the if/elif blocks need to be calculated based on the canvas_width or canvas_height respectively.
- lots of common code between the two if/elif blocks. Some of it could be taken out. Personally, I would just set the new canvas/width or height. Then outside of the conditions the code would take care of offsets and such. Yes, the computations would yield 0 for one of the values...
The background will actually overflow the new canvas size (see attached image). If I just resized the image to the new canvas size, it wouldn't have the same aspect ratio and would be squished horizontally or vertically
- I don't see the purpose of computing bg_scale, since anyway the background will be sized to the new canvas dimensions that you already have.
Let me know if there's anything else that can be improved.
Now you have a problem, if your image is already 16/9 you exit without closing the undo group (and with a useless layer copy). You can delay the layer copy until after you have done all your size computations and tests, so that when everything is OK, you start the undo group, do the copy/resize/blur, and then close the undo group. This has the added benefit of not marking the image "dirty" is nothing happened.