You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to resize a 500x280 GIF via the Resize function. If the scale parameter is a multiple of 5 (e.g. 0.1, 0.15 or 0.2) it works fine in unrolling the GIF.
The problem is when the scale has isn't a multiple of 5 (e.g. 0.14, 0.22 or 0.66) it can't unroll. It will always return a roll.
This behavior is only for two decimals. With more decimals it becomes even more confusing as 0.265 doesn't work either. Maybe due to the 6 in it?
After fiddling with it for a bit, rounding the scale or forcing a multiple fixes the issue, but also does not allow for the intended scale on the final image.
Additionally I've noticed that in the ResizeWithVScale function it calculates the new page height with int(float64(pageHeight) * scale) which forces it to drop the decimal if it exists. Perhaps this is causing the issue? LibVips takes an int so I understand why it's done.
This only happens with animated images (tested only on GIF). Non-animated images work fine, likely due to their height always being an integer.
To replicate this issue, take a GIF with a width of 500 and try resizing it to the above mentioned scales.
I'm trying to resize a 500x280 GIF via the Resize function. If the scale parameter is a multiple of 5 (e.g. 0.1, 0.15 or 0.2) it works fine in unrolling the GIF.
The problem is when the scale has isn't a multiple of 5 (e.g. 0.14, 0.22 or 0.66) it can't unroll. It will always return a roll.
This behavior is only for two decimals. With more decimals it becomes even more confusing as 0.265 doesn't work either. Maybe due to the 6 in it?
After fiddling with it for a bit, rounding the scale or forcing a multiple fixes the issue, but also does not allow for the intended scale on the final image.
Additionally I've noticed that in the ResizeWithVScale function it calculates the new page height with int(float64(pageHeight) * scale) which forces it to drop the decimal if it exists. Perhaps this is causing the issue? LibVips takes an int so I understand why it's done.
This only happens with animated images (tested only on GIF). Non-animated images work fine, likely due to their height always being an integer.
To replicate this issue, take a GIF with a width of 500 and try resizing it to the above mentioned scales.
Here's the logic I'm using to resize the GIF:
The text was updated successfully, but these errors were encountered: