スキップしてメイン コンテンツに移動

投稿

ラベル(palette)が付いた投稿を表示しています

Java: Create Indexed PNG Image Using Standard Java Image API

Hello guys! I have written Java: How to Create Indexed PNG Using PNGJ Library a few years ago. Recently I investigated how to create indexed png by standard Java image API. I have googled and tested various methods, finally I figureed out how to create indexed png image. Still my program is not perfect (of course most of the case it worked well), I believe that this program gives you the hint to creating indexed png and image manipulation on standard Java API. Code Actually the method is quite straigt forward. Please see the code below :) The advantedge of this code is the code doesn't require any library. The code below contains all of the stuffs needed for creating indexed png image! package com.dukesoftware.util.image; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.ColorConvertOp; import java.awt.image.ColorModel; import java.awt.image.DataBuffer; import java.awt.image.IndexColorModel; import java.io.File; import java.

Java: How to Create Indexed PNG Using PNGJ Library

I'm working on Google App Engine for Java (GAEJ) now. Very excited about working on it because can develop Java Web App quite easliy & quickly! However I faced a limitation of image processing on GAEJ. On GAEJ, java.awt pakage.* is not supported. That means we cannot use BufferedImage etc!! As you know, Google provides com.google.appengine.api.images.* for image processing on GAEJ, something like below: ImagesService imagesService = ImagesServiceFactory.getImagesService(); Image srcImage = ImagesServiceFactory.makeImage(srcImageData); // some transformations. Transform crop = ImagesServiceFactory.makeCrop(0.3, 0, 1, 0.70); OutputSettings settings = new OutputSettings(OutputEncoding.PNG); // apply transform Image newImage = imagesService.applyTransform(crop, srcImage, settings); byte[] newImageData = newImage.getImageData(); It can read jpg, png, gif images accroding to the official document. And if transformation is applied, the output binary data becomes png forma