| | |
| | | Java-Code zum Verkleinern von Bildern |
| | | |
| | | args[0] - Anzahl Pixel an der laengsten Kante |
| | | args[1] - qualitaet JPEG, z.B. 75 fuer 75% |
| | | args[1] - qualitaet JPEG, z.B. 0.75 fuer 75% des Originals |
| | | args[2] - Eingangsordner |
| | | args[3] - Ausgabeordner |
| | | */ |
| | |
| | | imgType = "jpg"; |
| | | } |
| | | |
| | | //ImageIO.write(thumbImage, imgType, outFile); |
| | | |
| | | /* 14.1.2018 Beginn */ |
| | | //File outfile =new File(“/opt/images/modified.jpg”); |
| | | /* |
| | | 14.1.2018: Ausgabe um Qualitaetsparameter erweitert |
| | | Beginn |
| | | */ |
| | | ImageWriter writer = ImageIO.getImageWritersByFormatName(imgType).next(); |
| | | //ImageWriter writer = iter.next(); |
| | | ImageWriteParam iwp = writer.getDefaultWriteParam(); |
| | | iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); |
| | | iwp.setCompressionQuality(quality); |
| | | writer.setOutput(new FileImageOutputStream(outFile)); |
| | | writer.write(null, new IIOImage(thumbImage, null, null),iwp); |
| | | writer.write(null, new IIOImage(thumbImage, null, null), iwp); |
| | | writer.dispose(); |
| | | /* 14.1.2018 Ende */ |
| | | |
| | | |
| | | } |
| | | } catch (InterruptedException ex) { |
| | | System.out.println("Error: " + ex.getLocalizedMessage()); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | System.out.println("fileList is null or empty"); |