Libraryless. Click here for Pure Java version (7100L/42K).
// works for .gif also. SCALE_DEFAULT has to be used // (https://stackoverflow.com/questions/9392227/resizing-animated-gif-while-keeping-its-animation-using-java) static ImageIcon resizeImageIcon(ImageIcon icon, int newW) { var img = icon.getImage(); int newH = iround(img.getHeight(null)*(double) newW/img.getWidth(null)); ret imageIcon(resizeImage_raw(img, newW, newH, Image.SCALE_DEFAULT)); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033900 |
Snippet name: | resizeImageIcon |
Eternal ID of this version: | #1033900/4 |
Text MD5: | d74fb373c8d7eda90e3d5459a4f3af95 |
Transpilation MD5: | e86b11237817090d72815d3a90d7effb |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-09 19:24:29 |
Source code size: | 407 bytes / 7 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 159 / 212 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |