Libraryless. Click here for Pure Java version (3026L/17K).
static BufferedImage scaleBufferedImagePixelated(BufferedImage img, int w, int h) { int w1 = img.getWidth(), h1 = img.getHeight(); int[] pixels1 = pixelsOfBufferedImage(img); int[] pixels = new[w*h]; int i = 0; double y1 = 0, ystep = doubleRatio(h1, h), xstep = doubleRatio(w1, w); for y to h: { int i1 = ifloor(y1)*w1; y1 += ystep; double x1 = 0; for x to w: { pixels[i++] = pixels1[i1+ifloor(x1)]; x1 += xstep; } } ret intArrayToBufferedImage(pixels, w, h); }
Began life as a copy of #1025282
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1031991 | 
| Snippet name: | scaleBufferedImagePixelated | 
| Eternal ID of this version: | #1031991/3 | 
| Text MD5: | 35390c77e0a2693fa293082153804af1 | 
| Transpilation MD5: | 79c0f08039f4a5650221dcb304fcefc5 | 
| Author: | stefan | 
| Category: | javax / imaging | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2021-08-07 16:35:22 | 
| Source code size: | 525 bytes / 17 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 365 / 463 | 
| Version history: | 2 change(s) | 
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1035819 - resizeImage2B (pixelated) - analog to #1031991 |