java.awt.* is not supported by GAE? how to resolve this? - java

BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
in app engine , i found it doesn't work, it said that java.awt.image.bufferedImage is not supported by GAE.and java.awt.*, javax.imageio.ImageWriter also are not suppoted by GAE. so can someone tell me how to implement those functions in GAE?

so can someone tell me how to implement those functions in GAE?
The simple answer is that it is not possible in GAE.

The Google App Engine has a great built-in Images API for image processing tasks.
For filesystem emulation on the Google App Engine, have a look at GAE VFS
In short, the way you are trying to accomplish your goal is inconsistent with the design of the App Engine.

If the usual built-in packages aren't available, you could try Jimi, which is a pure Java image processing library. It hasn't been updated in the best part of a decade, but it should do the job. No school like the old school.

GAE does not support java.awt images. You have to use GAE Image API to work with images.
Reference: https://developers.google.com/appengine/docs/java/images/
This API operates with bytes. The source/destination of your image data can be: post from form, URL connection, DataStore BLOB or BlobStorage.

For some seasons, when you are using external libs already using BufferedImage behind the scenes the GAE's ImageService is useless. I have googled out https://github.com/witwall/appengine-awt but haven't tryed it yet. i believe it is enough to just add the dependency of this lib to the project to make it working.

Related

QRcode decoder on Google App Engine

I am trying to write a Google App Engine (GAE) Java app to decode QRcodes. Users of my app will send an email to the app with an image containing a QRcode which they want to decode and my GAE app would send a reply with the decoded info. I was planning to use zxing library for this.
Currently I am able to extract the image which came as an attachment in the email. But now to use zxing I need imageIO and BufferedImage classes, which are not part of GAE whitelist. So I am stuck. Can somebody please help me figure out how I can decode a QRcode, with or without zxing?
Google provides their own API for working with images on GAE. You will need to use this API instead of javax.imageio.*. Or rather, since it's your library that makes use of these classes, you'll have to modify the library's source code to work with the GAE classes (or switch to a different library, or write your own). That may be a fairly sizeable job, depending upon how heavily the library relies upon javax.imageio.*.
Edit: Maybe you can refactor your code to use zxing's web-based decoder? That might be simpler than trying to modify their library to use the GAE image API.

GoogleAppEngine Java Captcha without external providers

Is there any library for captcha generation which does not contain blacklisted classes ?
I would like to avoid to use recaptcha.
I tried JCaptcha and SimpleCaptcha but both use AWT for image generation.
The google ticket http://code.google.com/p/googleappengine/issues/detail?id=1423&q=awt&colspec=ID%20Type%20Component%20Status%20Stars%20Summary%20Language%20Priority%20Owner%20Log has been accepted 1 year ago but we don't have news about it.
The Java runtime doesn't currently have any support for image manipulation, short of writing your own decode/encode/pixel-bitbashing code. You're unlikely to find any tools that do their own image manipulation rather than using AWT.
Your best option is to use an external service.
I've found http://code.google.com/p/litetext/ which works for me.

Best way to handle images in Java

I will develop a Java application that uses some image processing algorithms. I have done some image processing applications using C++. I'm currently using BufferedImage object to save data from images but I'm wondering if there is a better way to handle images in Java (improve performance).
Do you guys have any recommendation?
Thanks!!!
if you want to work with images i would look at JavaCv: https://github.com/bytedeco/javacv
JavaCV first provides wrappers to commonly used libraries by researchers in the field of computer vision: OpenCV, FFmpeg, libdc1394, PGR FlyCapture, OpenKinect, videoInput, and ARToolKitPlus.
I think you will find all what you need.
Luca
For JAVA there exists for example:
FiJi
ImageJ
Fiji
BoofCV
Rapidminer with IMMI (for image mining)

Java: create graphics without awt?

Is there any library out there to create graphics without using AWT?
What I need is simple drawing functions (like to draw a line) and text drawing functions to create graphics in memory for a Google app engine application. App engine does not support AWT.
Thanks!
Not unless you want to implement your own image class (say, a bitmap) and rendering algorithms for lines, shapes, images.
If you have experience with computer graphics and rasterization, this may not be very hard, but otherwise it will be more than you want to bite off.
You might also try the appengine-awt project, though it's a bit experimental.
You might try using SenseLan. In the requirements section, it says they don't use awt or ImageIO. Of course, there is the Images api but it seems fairly limited in what it offers.
Edit:
It looks like there are a couple of Python possibilities that could offer you some limited drawing capabilities. You could probably write appropriate image functionality as python web services, and keep the rest of the app in Java:
Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)
http://denislaprise.com/2008/08/21/drawing-images-on-google-app-engine/
Use Batik for GAE which is available as a dependency of FOP on GAE.
You can also track the issue further on the Google app engine bug tracker where others have shared other ideas in the comments.
'The Java 2D API is a set of classes for advanced 2D graphics and imaging, encompassing line art, text, and images'
http://java.sun.com/products/java-media/2D/index.jsp
Here's another possibility: org.eclipse.draw2d It probably relies on eclipse SWT.
TinyLine provides vector graphics support on the Google App Engine server side, and also provides SVG rendering support. See the SVG Thumbnail images demo.
Google Web Toolkit contains a nice graphics library designed for interfacing with the Google app engine.
edit to clarify: Google App Engine is designed for hosting applications on the web. You need to design graphics that can run in the browser. To do this, you need to write code in a web language, Javascript, for example. Google Web Toolkit contains a Java graphics library which compiles down to Javascript, saving you the effort of writing the Javascript yourself.
I hesitate to mention PJA, which appears to work if the AWT classes are present, but the security manager prevents you from using them.
If you can use Python on GAE instead of Java, then there's pybmp.

Is it possible to record video of a Java Swing Component?

I am looking for a way to make a video out of a java JComponent. I found ways to save components as images, but ideally I would like to be able to have the component paint to the screen and to a video file. I am hoping to find a solution that does not require libraries outside of the core JDK, but lightweight libraries might be considered.
Thanks
I don't believe there are libraries that will do what you are asking. Indeed, it seems a rather strange approach. Could you explain what it is that you are trying to achieve.
I suspect that a more viable approach is to use a screen video capture tool like Camtasia to capture what the user is doing. It costs money, but they do have an evaluation download if your boss is a cheapskate.
The core Java JDK doesn't provide a way to write videos, but you can create videos from raw images using the Xuggler open-source project. See this source code for examples of creating a video from raw images that are snapshots of a desktop.
Art

Categories