BufferedImage in Android

No. You can’t use BufferedImage because, like you said, javax.imageio isn’t in the Android SDK. The Bitmap class, however, does support getting individual pixels using the getPixel() and getPixels() methods so you should be able to use those to do any type of image transform you want to do.

How do I draw an image to a JPanel or JFrame?

Try this: package com.sandbox; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.WindowConstants; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class SwingSandbox { public static void main(String[] args) throws IOException { JFrame frame = buildFrame(); final BufferedImage image = ImageIO.read(new File(“C:\\Projects\\MavenSandbox\\src\\main\\resources\\img.jpg”)); JPanel pane = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); … Read more

Rotate a buffered image in Java

As always, the Internet to the rescue. So, this is some code which I hobbled together from other resources/post/blogs which will return a new image which is sized so it will contain the rotated image public BufferedImage rotateImageByDegrees(BufferedImage img, double angle) { double rads = Math.toRadians(angle); double sin = Math.abs(Math.sin(rads)), cos = Math.abs(Math.cos(rads)); int w … Read more

Drawing a Component to BufferedImage causes display corruption

Summary: The original JScrollNavigator uses the Swing opacity property to render a convenient green NavBox over a scaled thumbnail of the component in an adjacent JScrollPane. Because it extends JPanel, the (shared) UI delegate’s use of opacity conflicts with that of the scrollable component. The images seen in edit 5 above typify the associated rendering … Read more